From 45fa9d32734955e323c9fdebff97fceb68a99c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Sat, 11 Aug 2018 09:45:11 +0200 Subject: [PATCH] Clean up after yum tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests create empty directories in current working directory, but they never clean them up. Instead we can switch to a temporary location that will be cleaned up automatically. Signed-off-by: Lubomír Sedlář --- tests/test_gather.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_gather.py b/tests/test_gather.py index 60085b89..95b768e5 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -1696,6 +1696,10 @@ class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase): super(PungiYumDepsolvingTestCase, self).setUp() self.ks = os.path.join(self.tmp_dir, "ks") self.out = os.path.join(self.tmp_dir, "out") + self.cwd = os.path.join(self.tmp_dir, "cwd") + os.mkdir(self.cwd) + self.old_cwd = os.getcwd() + os.chdir(self.cwd) logger = logging.getLogger('Pungi') if not logger.handlers: @@ -1705,6 +1709,10 @@ class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase): console.setLevel(logging.INFO) logger.addHandler(console) + def tearDown(self): + os.chdir(self.old_cwd) + super(PungiYumDepsolvingTestCase, self).tearDown() + def go(self, packages, groups, lookaside=None, prepopulate=None, fulltree_excludes=None, multilib_blacklist=None, multilib_whitelist=None, **kwargs):