mirror of https://github.com/borgbackup/borg.git
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:
parent
e5b647fbd1
commit
738ed5d91b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue