mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +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:
parent
e5b647fbd1
commit
738ed5d91b
1 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue