如何在Nose2中运行特定测试

2023-12-24

在以前版本的 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 http://nose.readthedocs.org/en/latest/usage.html#selecting-tests

但是,我在 Nose2 中找不到任何有关类似测试选择的信息。有一个mention https://nose2.readthedocs.org/en/latest/differences.html#test-discovery-and-loading在关于不同测试发现的文档中,但这似乎并不相关。

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


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

dev/tests/test_file.py

我可以通过以下方式运行它:

nose2 -s dev tests.test_file

此外,我可以在测试用例中运行特定的测试方法,如下所示:

nose2 -s dev tests.test_file.TestCase.test_method

这能实现你想要的吗?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在Nose2中运行特定测试 的相关文章

随机推荐