List all Tests Found by Nosetest

你。 提交于 2019-12-18 13:53:12

问题


I use nosetests to run my unittests and it works well. I want to get a list of all the tests nostests finds without actually running them. Is there a way to do that?


回答1:


Version 0.11.1 is currently available. You can get a list of tests without running them as follows:

nosetests -v --collect-only



回答2:


I recommend using:

nosetests -vv --collect-only

While the -vv option is not described in man nosetests, "An Extended Introduction to the nose Unit Testing Framework" states that:

Using the -vv flag gives you verbose output from nose's test discovery algorithm. This will tell you whether or not nose is even looking in the right place(s) to find your tests.

The -vv option can save time when trying to determine why nosetests is only finding some of your tests. (In my case, it was because nosetests skipped certain tests because the .py scripts were executable.)

Bottom line is that the -vv option is incredibly handy, and I almost always use it instead of the -v option.




回答3:


There will be soon: a new --collect switch that produces this behavior was demo'd at PyCon last week. It should be on the trunk "soon" and will be in the 0.11 release.

The http://groups.google.com/group/nose-users list is a great resource for nose questions.



来源:https://stackoverflow.com/questions/712020/list-all-tests-found-by-nosetest

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