diff --git a/tests/trial_dir.py b/tests/trial_dir.py index 975a77588..16fab8045 100644 --- a/tests/trial_dir.py +++ b/tests/trial_dir.py @@ -65,8 +65,7 @@ class TrialDir(object): logging.error('Leaking %s' % TrialDir.TRIAL_ROOT) -class TestCase(unittest.TestCase): - """Base unittest class that cleans off a trial directory in tearDown().""" +class TrialDirMixIn(object): def setUp(self): # Create a specific directory just for the test. self.trial = TrialDir(self.id()) @@ -80,6 +79,17 @@ class TestCase(unittest.TestCase): return self.trial.root_dir +class TestCase(unittest.TestCase, TrialDirMixIn): + """Base unittest class that cleans off a trial directory in tearDown().""" + def setUp(self): + unittest.TestCase.setUp(self) + TrialDirMixIn.setUp(self) + + def tearDown(self): + TrialDirMixIn.tearDown(self) + unittest.TestCase.tearDown(self) + + if '-l' in sys.argv: # See SHOULD_LEAK definition in TrialDir for its purpose. TrialDir.SHOULD_LEAK = True