Skip unittest if some-condition in SetUpClass fails

ⅰ亾dé卋堺 提交于 2019-11-28 23:21:08

Got the answer:

For those who gets stuck here-

unittest can be skipped from setUpClass in following way-

raise unittest.SkipTest(message)
studgeek

Instead of explicitly raising the SkipTest exception, the documentation suggests using TestCase.skipTest(). For example:

def setUp(self):
    if skip_tests_flag:
        self.skipTest('skipped test due to skip_tests_flag')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!