Ale*_*hen 5 python pycharm python-unittest
Pycharm测试运行窗口中有一个“显示忽略”按钮。我想知道如何将某些测试标记为已忽略?
仅使用Python unittest,您就可以装饰要跳过的测试@skip。来自unittest-单元测试框架-Python 2或unittest-单元测试框架-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
Run Code Online (Sandbox Code Playgroud)
我认为PyCharm正在向您显示跳过的测试。