Clean up after yum tests

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-08-11 09:45:11 +02:00
parent 03ee632cc8
commit 45fa9d3273

View File

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