如何在Nose2中运行特定测试 [英] How to run specific test in Nose2
问题描述
在以前版本的鼻子测试框架中,有几种方法可以仅指定所有测试的子集:
In previous version of Nose testing framework, there were several ways to specify only a subset of all tests:
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中找不到有关类似测试选择的任何信息.文档中有关于不同测试发现的提及 ,但这似乎无关.
However, I can't find any information about similar test selection in Nose2. There's a mention in docs about different test discovery, but that doesn't seem to be related.
有没有办法在鼻子2或(更一般地)在unittest2中选择特定的测试或测试用例?
Is there a way to select a specific test or test case in nose2 or (more generally) in unittest2?
推荐答案
我在dev/tests中有一些测试,例如:
I have some tests in dev/tests, for example:
dev/tests/test_file.py
我可以通过以下方式运行它:
I am able to run this with:
nose2 -s dev tests.test_file
此外,我还可以在测试用例中运行特定的测试方法,如下所示:
Additionally, I'm able to run a specific test method in a test case as follows:
nose2 -s dev tests.test_file.TestCase.test_method
能完成您想要的吗?
这篇关于如何在Nose2中运行特定测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!