Reputation: 5762
I want to skip all the unit-tests if some condition doesn't satisfy under setUpClass
function. Like -
@classmethod
def setUpClass(cls):
if(!condition):
cls.skipTest("For some reason")
After doing this I'm expecting other unittest cases will not run. But it's showing an error
TypeError: skipTest() missing 1 required positional argument: 'reason'
Upvotes: 2
Views: 897
Reputation: 49774
You can raise the SkipTest
exception like:
@classmethod
def setUpClass(cls):
if not condition:
raise unittest.SkipTest("For some reason")
Upvotes: 6