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):