The setup.py test
runner is rather limited; it only supports letting you specify a specific module. The documentation for the command-line switches is given when you use the --help
switch:
python setup.py test --help
Common commands: (see '--help-commands' for more)
[ ... cut ... ]
Options for 'test' command:
--test-module (-m) Run 'test_suite' in specified module
--test-suite (-s) Test suite to run (e.g. 'some_module.test_suite')
[ ... more cut ... ]
so python setup.py test -m your.package.tests.test_module
would limit running the tests from the test_module.py
file only.
All the test
command does, really, is make sure your egg has been built already, extract the test_suite
value from setup()
metadata, configure a test loader that understands about zipped eggs, then run the unittest.main()
function.
If you need to run a single test only, have already built your egg, are not running this with a zipped egg, then you can also just use the unittest
command line interface, which does pretty much everything else:
python -m unittest yourpackage.tests.TestClass.test_method
would instruct unittest
to only run a very specific test method.