nose发现以 开头的测试test_,以及 的子类unittest.TestCase。
如果希望运行单个TestCase测试,例如:
# file tests.py
class T(unittest.TestCase):
def test_something():
1/0
这可以在命令行上完成:
nosetests tests:T.test_something
有时我更喜欢编写一个简单的函数并跳过所有unittest样板:
def test_something_else():
assert False
nose在这种情况下,当它运行我所有的测试时,它仍然会运行。但是我怎么能告诉nose使用(Unix)命令行只运行那个测试呢?