summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-10-27 19:21:35 +0300
committerLars Wirzenius <liw@liw.fi>2016-10-27 19:21:35 +0300
commit82ad0c0dc5b9b09577c4086ad23e0fa48cc0845a (patch)
tree971127de7450745522be63eb62ebd90b7aced86a
parentb1967189ea3e054305977cb586825bf222a05863 (diff)
downloadobnam-82ad0c0dc5b9b09577c4086ad23e0fa48cc0845a.tar.gz
Ignore errors when removing temporary dirs for testing
Due to some interaction with gpg-agent in gpg 2.1, autospawning of said agent, and a socket file it creates and removes, rmtree would previously fail due to the socket having disappeared. Mysterious, but works now.
-rw-r--r--obnamlib/encryption.py2
-rw-r--r--obnamlib/encryption_tests.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index 45611401..35ac1da2 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -180,7 +180,7 @@ class Keyring(object):
''', gpghome=self._gpghome)
def _cleanup(self):
- shutil.rmtree(self._gpghome)
+ shutil.rmtree(self._gpghome, ignore_errors=True)
self._gpghome = None
@property
diff --git a/obnamlib/encryption_tests.py b/obnamlib/encryption_tests.py
index 86fd2fa0..fc795fad 100644
--- a/obnamlib/encryption_tests.py
+++ b/obnamlib/encryption_tests.py
@@ -41,7 +41,7 @@ class SymmetricEncryptionTests(unittest.TestCase):
self.gpghome = tempfile.mkdtemp()
def tearDown(self):
- shutil.rmtree(self.gpghome)
+ shutil.rmtree(self.gpghome, ignore_errors=True)
def test_generates_key_of_correct_length(self):
numbits = 16
@@ -112,7 +112,7 @@ class GetPublicKeyTests(unittest.TestCase):
self.keyid = '1B321347'
def tearDown(self):
- shutil.rmtree(self.dirname)
+ shutil.rmtree(self.dirname, ignore_errors=True)
def test_exports_key(self):
key = obnamlib.get_public_key(self.keyid, gpghome=self.gpghome)
@@ -189,7 +189,7 @@ class PublicKeyEncryptionTests(unittest.TestCase):
self.keyid = '1B321347'
def tearDown(self):
- shutil.rmtree(self.dirname)
+ shutil.rmtree(self.dirname, ignore_errors=True)
def test_roundtrip_works(self):
cleartext = 'hello, world'