2 small archiver testsuite fixes

environment context manager: if a env var was not present before, it should not be present afterwards

teardown: cd out of the tmpdir before deleting it
This commit is contained in:
Thomas Waldmann 2015-08-15 17:07:09 +02:00
parent e5b647fbd1
commit 738ed5d91b
1 changed files with 4 additions and 2 deletions

View File

@ -58,7 +58,9 @@ class environment_variable:
def __exit__(self, *args, **kw):
for k, v in self.old_values.items():
if v is not None:
if v is None:
del os.environ[k]
else:
os.environ[k] = v
@ -89,8 +91,8 @@ class ArchiverTestCaseBase(BaseTestCase):
os.chdir(self.tmpdir)
def tearDown(self):
shutil.rmtree(self.tmpdir)
os.chdir(self._old_wd)
shutil.rmtree(self.tmpdir)
def cmd(self, *args, **kw):
exit_code = kw.get('exit_code', 0)