如何在Nose2中运行特定测试

Tom*_*ich 14 python nosetests unittest2 nose2

在以前版本的Nose测试框架中,有几种方法只能指定所有测试的子集:

nosetests test.module
nosetests another.test:TestCase.test_method
nosetests a.test:TestCase
nosetests /path/to/test/file.py:test_function
Run Code Online (Sandbox Code Playgroud)

http://nose.readthedocs.org/en/latest/usage.html#selecting-tests

但是,我找不到有关Nose2中类似测试选择的任何信息.有一个提到的关于不同的测试发现文档,但似乎并没有被相关.

有没有办法在nose2或(更一般地)unittest2中选择特定的测试或测试用例?

mma*_*gin 22

我在开发/测试中有一些测试,例如:

dev/tests/test_file.py
Run Code Online (Sandbox Code Playgroud)

我可以用以下方式运行:

nose2 -s dev tests.test_file
Run Code Online (Sandbox Code Playgroud)

另外,我能够在测试用例中运行特定的测试方法,如下所示:

nose2 -s dev tests.test_file.TestCase.test_method
Run Code Online (Sandbox Code Playgroud)

这会实现你想要的吗?