Testing packages
In Chapter 10, Testing and Logging – Preparing for Bugs, the testing chapter, we saw a few of the many testing systems for Python. As you might suspect, at least some of these have setup.py
integration.
Unittest
Before we start, we should create a test script for our package. For actual tests, look at Chapter 10, Testing and Logging – Preparing for Bugs, the testing chapter. In this case, we will just use a no-op test, test.py
:
import unittest class Test(unittest.TestCase): def test(self): pass
The standard python setup.py test
command will run the regular unittest
command:
# python setup.py -v test running test running "unittest --verbose" running egg_info writing Our_little_project.egg-info/PKG-INFO writing dependency_links to Our_little_project.egg-info/dependency_links.txt writing top-level names to Our_little_project.egg-info/top_level.txt writing entry points to Our_little_project.egg-info/entry_points.txt reading manifest file &apos...