Skip to content

Commit

Permalink
Test cleanup method
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Richter <jarichte@redhat.com>
  • Loading branch information
richtja committed Mar 9, 2021
1 parent f41611c commit aab4af7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions avocado/core/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,21 +1034,19 @@ def fetch_asset(self, name, asset_hash=None, algorithm=None,
# otherwise re-throw OSError
raise e

def tearDown(self):
def _cleanup(self):
if self.__base_logdir_tmp is not None:
self.__base_logdir_tmp.cleanup()
self.__base_logdir_tmp = None
if not self.__config.get('run.keep_tmp') and os.path.exists(
self.__base_tmpdir):
shutil.rmtree(self.__base_tmpdir)

def tearDown(self):
self._cleanup()

def __del__(self):
if self.__base_logdir_tmp is not None:
self.__base_logdir_tmp.cleanup()
self.__base_logdir_tmp = None
if not self.__config.get('run.keep_tmp') and os.path.exists(
self.__base_tmpdir):
shutil.rmtree(self.__base_tmpdir)
self._cleanup()


class SimpleTest(Test):
Expand Down

0 comments on commit aab4af7

Please sign in to comment.