问题
I want to create a test suite manually instead of using test discovery (only in one module, the others should use discovery). I found how I can do this in unittests, but I'm not sure how to transfer that to nose and how it mixes with the discovery. The nose docs don't have examples and I don't understand how I'm supposed to use them. Could somebody please give me an example?
Details: I have test classes where I want to run each method a few times with different parameters. Ideally also changing the test names to something readable. I tried test generators, but they are quite buggy.
回答1:
Give nosetests the path to your suite, and it will be executed instead of using Nose's test discovery.
This command:
nosetests
Does automatic test discovery.
These commands:
nosetests /path/to/file.py
nosetests /path/to/directory
Run the tests in file.py
and directory
respectively.
Alternatively, you could start auto discovery in a specific directory:
nosetests -w /path/to/directory
Check out nosetests -h for a full list of options.
来源:https://stackoverflow.com/questions/11210519/manually-adding-test-suite-to-nose