在 Python 中使用 unittest
模块时如何暂时禁用单个单元测试?
最佳答案
可以使用 unittest.skip
禁用单独的测试方法或类。装饰器。
@unittest.skip("reason for skipping")
def test_foo():
print('This is foo test case.')
@unittest.skip # no reason needed
def test_bar():
print('This is bar test case.')
有关其他选项,请参阅 Skipping tests and expected failures 的文档.
关于python - 暂时禁用单个 Python 单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2066508/