From fa007bfa7cdc27c91727336f8ff64036f71ba379 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 24 Nov 2017 12:57:55 +0100 Subject: [PATCH] remove build folder, if created through setup-process in test --- fail2ban/tests/misctestcase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fail2ban/tests/misctestcase.py b/fail2ban/tests/misctestcase.py index 373a7178..fda1a5cd 100644 --- a/fail2ban/tests/misctestcase.py +++ b/fail2ban/tests/misctestcase.py @@ -121,6 +121,7 @@ class SetupTest(unittest.TestCase): if not self.setup: return # if verbose skip didn't work out tmp = tempfile.mkdtemp() + remove_build = not os.path.exists('build') # suppress stdout (and stderr) if not heavydebug supdbgout = ' >/dev/null' if unittest.F2B.log_level >= logging.DEBUG else '' # HEAVYDEBUG try: @@ -178,6 +179,8 @@ class SetupTest(unittest.TestCase): # remove build directory os.system("%s %s clean --all%s" % (sys.executable, self.setup, (supdbgout + ' 2>&1') if supdbgout else '')) + if remove_build and os.path.exists('build'): + shutil.rmtree('build') class TestsUtilsTest(LogCaptureTestCase):