我有一个名为test_web.py的文件,其中包含一个类TestWeb和许多名为test_something()的方法。
我可以像这样运行类中的每个测试:
$ nosetests test_web.py
...
======================================================================
FAIL: checkout test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/me/path/here/test_web.py", line 187, in test_checkout
...
但我似乎不能单独运行测试。当在相同的PWD中运行时,这些命令会给出“没有这样的测试”的错误:
$ nosetests test_web.py:test_checkout
$ nosetests TestWeb:test_checkout
这里会有什么问题呢?
发布于 2012-07-02 08:58:19
您必须像这样指定它:nosetests <file>:<Test_Case>.<test_method>
或
nosetests test_web.py:TestWeb.test_checkout
请参阅the docs
发布于 2013-08-20 18:19:18
您还可以指定一个模块:
nosetests tests.test_integration:IntegrationTests.test_user_search_returns_users
发布于 2017-05-22 17:21:56
要运行多个特定测试,只需将它们添加到命令行,用空格分隔即可。
nosetests test_web.py:TestWeb.test_checkout test_web.py:TestWeb.test_another_checkout
https://stackoverflow.com/questions/11286688
复制相似问题