I have this test class:
class mytest(unittest.TestCase):
def setUp(self):
os.mkdir(...)
...
def tearDown(self):
shutil.rmtree(...)
def test_one(self):
...
def test_two(self):
...
If something fails after mkdir has ran when running setUp of test_one, it will still try to run setUp of test_two. At this point I'll get an error on mkdir because rmtree didn't run.
Is there any way to tell Python unittest to stop running the current test if setUp fails? I'm not looking to stop on a regular test failure.
setUpmethod and fail accordingly