How-To's‎ > ‎Python‎ > ‎

unit tests

Creating a testing framework with standard module unittest and setuptools

To run all tests: python test allows selective testing of modules or suites
python test --test-module package.tests.module_test                   # run
python test --test-suite package.tests.module_test.test_suite  # run test_suite within

Alternatively, unittest has a command line interface that allows running of modules, suites, and even single cases:
python -m unittest module_test                                                         # run
python -m unittest module_test.TestClass                                # run test class TestClass inside
python -m unittest module_test.TestClass.test_method # run test case test_method inside test class TestClass inside