Based on current searching on webs, there are two candidates for python unit test.
- unittest module in Python's standard library, named PyUnit before going into Python's standard library.
- py.test, a third-party unit test framework, need to be installed.
See below table from List of unit testing frameworks for Python
* Except py.test and Doctest, the items listed above are extensions for Python's unittest module.
- tests are run via "py.test" command line tool.
- automatic test discovery, py.test walks over the filesystem and:
- discovers "test_*.py" test files
- discovers "test_" functions and "Test" classes
- asserting expected exceptions
- skipping tests
- test functions and funcargs, a unique py.test feature:
- a mechanism for managing your test fixtures
- individual fixtures can be managed separately
- full separation between test code and fixtures
- can easily depend on command line options
- convenient "builtin" funcargs provided
- adding a command line option for py.test
- particularly play with options (``py.test -h``):
- -s disable catching of stdout/stderr
- -x exit instantly on first failure
- -l show locals in tracebacks.
- --pdb start Python debugger on errors
- --tb/fulltrace - control traceback generation.
- Customizing and Extending py.test
- feature list from home page