【发布时间】:2016-04-21 08:56:48
【问题描述】:
我有很多这样的遗留测试。使用 unittest 跳过测试,但使用 nosetests 运行。
import unittest
import nose
import time
class BaseTestClass(unittest.TestCase):
@unittest.skip("Skipped")
def test_add(self):
"""Test 1"""
print "Execute test 1"
time.sleep(5)
def test_sub(self):
"""Test 2"""
print "Execute test 2"
time.sleep(5)
if __name__ == '__main__':
nose.run(argv=["nose", ".", "--verbosity=2", "--nocapture", '--no-skip'])
我想运行所有跳过的测试。 看起来像“no-skip” - 选项不起作用,变成我有输出
Execute test 2
Test 1 ... Test 2 ... ok
----------------------------------------------------------------------
Ran 2 tests in 5.001s
OK
看起来 test 存在于输出中,但不执行内部代码。
我希望看到:
Test 1 ... ok
Execute test 1
Test 2 ... ok
Execute test 2
----------------------------------------------------------------------
Ran 2 tests in 10 s
OK
【问题讨论】:
-
--no-skip好像坏了github.com/nose-devs/nose/issues/889 -
为我工作 (nose-1.3.7-3)
标签: python nose python-unittest