当使用@ unittest.skip并运行测试时,通常跳过的测试用小s标记,并在最后报告计数。
如果我使用nosetests运行测试,测试就会消失,在最终报告中不会留下任何痕迹。 我试过--no-skip,但它没有改变任何东西。
如何在鼻子下跑步时有“s”标记和总跳过?
When one uses @unittest.skip and runs tests, generally the skipped tests are marked with a small s, and the tally is reported at the end.
If I run the tests with nosetests, the tests simply disappear, leaving no trace of their existence in the final report. I tried with --no-skip, but it didn't change anything.
How can I have the "s" marks and the total skipped while running under nose?
最满意答案
看起来你必须提供跳过测试的理由:
from unittest import skip @skip def foo_test(): pass给出你所观察到的:
---------------------------------------------------------------------- Ran 0 tests in 0.000s OK而:
from unittest import skip @skip("nose likes having good reasons") def foo_test(): pass会给你:
foo_test.foo_test ... SKIP: nose likes having good reasons ---------------------------------------------------------------------- Ran 1 test in 0.003s OK (SKIP=1)Looks like you have to provide a reason for skipping a test:
from unittest import skip @skip def foo_test(): passgives what you observed:
---------------------------------------------------------------------- Ran 0 tests in 0.000s OKwhile:
from unittest import skip @skip("nose likes having good reasons") def foo_test(): passwill give you:
foo_test.foo_test ... SKIP: nose likes having good reasons ---------------------------------------------------------------------- Ran 1 test in 0.003s OK (SKIP=1)标有@ unittest.skip的单元测试未在nosetests下标记(Unittests marked with @unittest.skip are not marked under nosetests)当使用@ unittest.skip并运行测试时,通常跳过的测试用小s标记,并在最后报告计数。
如果我使用nosetests运行测试,测试就会消失,在最终报告中不会留下任何痕迹。 我试过--no-skip,但它没有改变任何东西。
如何在鼻子下跑步时有“s”标记和总跳过?
When one uses @unittest.skip and runs tests, generally the skipped tests are marked with a small s, and the tally is reported at the end.
If I run the tests with nosetests, the tests simply disappear, leaving no trace of their existence in the final report. I tried with --no-skip, but it didn't change anything.
How can I have the "s" marks and the total skipped while running under nose?
最满意答案
看起来你必须提供跳过测试的理由:
from unittest import skip @skip def foo_test(): pass给出你所观察到的:
---------------------------------------------------------------------- Ran 0 tests in 0.000s OK而:
from unittest import skip @skip("nose likes having good reasons") def foo_test(): pass会给你:
foo_test.foo_test ... SKIP: nose likes having good reasons ---------------------------------------------------------------------- Ran 1 test in 0.003s OK (SKIP=1)Looks like you have to provide a reason for skipping a test:
from unittest import skip @skip def foo_test(): passgives what you observed:
---------------------------------------------------------------------- Ran 0 tests in 0.000s OKwhile:
from unittest import skip @skip("nose likes having good reasons") def foo_test(): passwill give you:
foo_test.foo_test ... SKIP: nose likes having good reasons ---------------------------------------------------------------------- Ran 1 test in 0.003s OK (SKIP=1)
发布评论