From 7c2025a2c0add837b7947c422de5003d5b696d81 Mon Sep 17 00:00:00 2001 From: Martin Hostettler Date: Mon, 26 Sep 2016 19:28:00 +0200 Subject: [PATCH 1/2] testsuite/archiver.py: Add a comment how to easily test ArchiverTestCaseBinary locally. --- borg/testsuite/archiver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py index 8fb9eddf3..6c74cca04 100644 --- a/borg/testsuite/archiver.py +++ b/borg/testsuite/archiver.py @@ -69,7 +69,7 @@ def exec_cmd(*args, archiver=None, fork=False, exe=None, **kw): sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr -# check if the binary "borg.exe" is available +# check if the binary "borg.exe" is available (for local testing a symlink to virtualenv/bin/borg should do) try: exec_cmd('help', exe='borg.exe', fork=True) BORG_EXES = ['python', 'binary', ] From 15444b19d1507fabf46291f7b216d883e3743f1f Mon Sep 17 00:00:00 2001 From: Martin Hostettler Date: Mon, 26 Sep 2016 19:28:28 +0200 Subject: [PATCH 2/2] testsuite/archiver.py: Fix key import failure with ArchiverTestCaseBinary --- borg/testsuite/archiver.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py index 6c74cca04..e7f805ed4 100644 --- a/borg/testsuite/archiver.py +++ b/borg/testsuite/archiver.py @@ -1263,12 +1263,18 @@ class ArchiverTestCase(ArchiverTestCaseBase): with open(export_file, 'w') as fd: fd.write('something not a key\n') - self.assert_raises(NotABorgKeyFile, lambda: self.cmd('key', 'import', self.repository_location, export_file)) + if self.FORK_DEFAULT: + self.cmd('key', 'import', self.repository_location, export_file, exit_code=2) + else: + self.assert_raises(NotABorgKeyFile, lambda: self.cmd('key', 'import', self.repository_location, export_file)) with open(export_file, 'w') as fd: fd.write('BORG_KEY a0a0a0\n') - self.assert_raises(RepoIdMismatch, lambda: self.cmd('key', 'import', self.repository_location, export_file)) + if self.FORK_DEFAULT: + self.cmd('key', 'import', self.repository_location, export_file, exit_code=2) + else: + self.assert_raises(RepoIdMismatch, lambda: self.cmd('key', 'import', self.repository_location, export_file)) def test_key_export_paperkey(self): repo_id = 'e294423506da4e1ea76e8dcdf1a3919624ae3ae496fddf905610c351d3f09239'