Manually adding test suite to nose

北城以北 提交于 2019-12-10 17:33:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!