Disable individual Python unit tests temporarily

后端 未结 7 814
臣服心动
臣服心动 2020-12-23 08:35

How can individual unit tests be temporarily disabled when using the unittest module in Python?

相关标签:
7条回答
  • 2020-12-23 09:33

    Individual test methods or classes can both be disabled using the unittest.skip decorator.

    @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.')
    

    For other options, see the docs for Skipping tests and expected failures.

    0 讨论(0)
提交回复
热议问题