1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 17:27:31 +00:00

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

View file

@ -58,7 +58,9 @@ def __enter__(self):
def __exit__(self, *args, **kw): def __exit__(self, *args, **kw):
for k, v in self.old_values.items(): 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 os.environ[k] = v
@ -89,8 +91,8 @@ def setUp(self):
os.chdir(self.tmpdir) os.chdir(self.tmpdir)
def tearDown(self): def tearDown(self):
shutil.rmtree(self.tmpdir)
os.chdir(self._old_wd) os.chdir(self._old_wd)
shutil.rmtree(self.tmpdir)
def cmd(self, *args, **kw): def cmd(self, *args, **kw):
exit_code = kw.get('exit_code', 0) exit_code = kw.get('exit_code', 0)