测试看起来像这样:
import unittest
class FooTestCase(unittest.TestCase):
@unittest.skip
def test_bar(self):
self.assertIsNone('not none')
使用pytest
运行时,报告如下所示:
path/to/my/tests/test.py::FooTestCase::test_bar <- ../../../../../usr/lib/python3.5/unittest/case.py PASSED
另一方面,如果我将@unittest.skip
替换为@pytest.mark.skip
,则会将其正确报告为已跳过:
path/to/my/tests/test.py::FooTestCase::test_bar <- ../../../../../usr/lib/python3.5/unittest/case.py SKIPPED
如果有人可以说,我做错了什么,或者是pytest
中的错误?
答案 0 :(得分:3)