Commit Diff


commit - 4c5ec309ca6064e8c942e1e40491448a8c80c96d
commit + 6b5f614d1011fa5f2114d491155a4aefa6c2ba2f
blob - c3749a8e1d9362b5562f92d93bc7a3de1a00c5f6
blob + 19420dd6c32c51f52bc16824822cf29326369fc0
--- dulwich/tests/test_porcelain.py
+++ dulwich/tests/test_porcelain.py
@@ -277,7 +277,10 @@ ya6JVZCRbMXfdCy8lVPgtNQ6VlHaj8Wvnn2FLbWWO2n2r3s=
         super(PorcelainGpgTestCase, self).setUp()
         self.gpg_dir = os.path.join(self.test_dir, "gpg")
         os.mkdir(self.gpg_dir, mode=0o700)
-        self.addCleanup(shutil.rmtree, self.gpg_dir)
+        # Ignore errors when deleting GNUPGHOME, because of race conditions
+        # (e.g. the gpg-agent socket having been deleted). See
+        # https://github.com/jelmer/dulwich/issues/1000
+        self.addCleanup(shutil.rmtree, self.gpg_dir, ignore_errors=True)
         self._old_gnupghome = os.environ.get("GNUPGHOME")
         os.environ["GNUPGHOME"] = self.gpg_dir
         if self._old_gnupghome is None: