在以前版本的 Nose 测试框架中,有几种方法可以只指定所有测试的一个子集:
nosetests test.module
nosetests another.test:TestCase.test_method
nosetests a.test:TestCase
nosetests /path/to/test/file.py:test_function
http://nose.readthedocs.org/en/latest/usage.html#selecting-tests
但是,我在 Nose2 中找不到任何关于类似测试选择的信息。有一个 mention在关于不同测试发现的文档中,但这似乎并不相关。
有没有办法在 nose2 或(更一般地)unittest2 中选择特定的测试或测试用例?
最佳答案
我在开发/测试中有一些测试,例如:
dev/tests/test_file.py
我可以用:
nose2 -s dev tests.test_file
此外,我能够在测试用例中运行特定的测试方法,如下所示:
nose2 -s dev tests.test_file.TestCase.test_method
这是否实现了您想要的?
关于python - 如何在 Nose2 中运行特定测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17890087/