答案 0 :(得分:6)
只需使用Python unittest
,就可以使用@skip
修饰要跳过的测试。来自unittest — Unit testing framework — Python 2或unittest — Unit testing framework — Python 3:
class MyTestCase(unittest.TestCase):
@unittest.skip("demonstrating skipping")
def test_nothing(self):
self.fail("shouldn't happen")
@unittest.skipIf(mylib.__version__ < (1, 3),
"not supported in this library version")
def test_format(self):
# Tests that work for only a certain version of the library.
pass
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
def test_windows_support(self):
# windows specific testing code
pass
我假设PyCharm正在向您展示跳过的测试。