--- dulwich/tests/test_porcelain.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) --- a/dulwich/tests/test_porcelain.py +++ b/dulwich/tests/test_porcelain.py @@ -83,7 +83,7 @@ class PorcelainTestCase(TestCase): def setUp(self): super(PorcelainTestCase, self).setUp() self.test_dir = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, self.test_dir) + self.addCleanup(shutil.rmtree, self.test_dir, ignore_errors=True) self.repo_path = os.path.join(self.test_dir, "repo") self.repo = Repo.init(self.repo_path, mkdir=True) self.addCleanup(self.repo.close) @@ -271,7 +271,7 @@ ya6JVZCRbMXfdCy8lVPgtNQ6VlHaj8Wvnn2FLbWW 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) + 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: @@ -365,7 +365,7 @@ class CommitTests(PorcelainTestCase): hooks_dir = os.path.join(self.repo.controldir(), "hooks") os.makedirs(hooks_dir, exist_ok=True) - self.addCleanup(shutil.rmtree, hooks_dir) + self.addCleanup(shutil.rmtree, hooks_dir, ignore_errors=True) c1, c2, c3 = build_commit_graph( self.repo.object_store, [[1], [2, 1], [3, 1, 2]] @@ -524,7 +524,7 @@ class CloneTests(PorcelainTestCase): self.repo.refs[b"refs/tags/foo"] = c3.id target_path = tempfile.mkdtemp() errstream = BytesIO() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) r = porcelain.clone( self.repo.path, target_path, checkout=False, errstream=errstream ) @@ -558,7 +558,7 @@ class CloneTests(PorcelainTestCase): self.repo.refs[b"refs/heads/master"] = c3.id target_path = tempfile.mkdtemp() errstream = BytesIO() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) with porcelain.clone( self.repo.path, target_path, checkout=True, errstream=errstream ) as r: @@ -581,7 +581,7 @@ class CloneTests(PorcelainTestCase): self.repo.refs[b"refs/heads/master"] = c3.id target_path = tempfile.mkdtemp() errstream = BytesIO() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) with porcelain.clone( self.repo.path, target_path, bare=True, errstream=errstream ) as r: @@ -602,7 +602,7 @@ class CloneTests(PorcelainTestCase): self.repo.refs[b"HEAD"] = c1.id target_path = tempfile.mkdtemp() errstream = BytesIO() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) self.assertRaises( porcelain.Error, porcelain.clone, @@ -621,7 +621,7 @@ class CloneTests(PorcelainTestCase): (c1,) = build_commit_graph(self.repo.object_store, commit_spec, trees) self.repo.refs[b"refs/heads/master"] = c1.id target_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) errstream = BytesIO() r = porcelain.clone( self.repo.path, target_path, checkout=True, errstream=errstream @@ -636,7 +636,7 @@ class CloneTests(PorcelainTestCase): (c1,) = build_commit_graph(self.repo.object_store, commit_spec, trees) self.repo.refs[b"refs/heads/master"] = c1.id target_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) errstream = porcelain.NoneStream() r = porcelain.clone( self.repo.path, target_path, checkout=True, errstream=errstream @@ -659,7 +659,7 @@ class CloneTests(PorcelainTestCase): self.repo.refs[b"refs/heads/else"] = c1.id target_path = tempfile.mkdtemp() errstream = BytesIO() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) r = porcelain.clone( self.repo.path, target_path, checkout=False, errstream=errstream ) @@ -678,12 +678,12 @@ class CloneTests(PorcelainTestCase): class InitTests(TestCase): def test_non_bare(self): repo_dir = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, repo_dir) + self.addCleanup(shutil.rmtree, repo_dir, ignore_errors=True) porcelain.init(repo_dir) def test_bare(self): repo_dir = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, repo_dir) + self.addCleanup(shutil.rmtree, repo_dir, ignore_errors=True) porcelain.init(repo_dir, bare=True) @@ -1449,7 +1449,7 @@ class PushTests(PorcelainTestCase): # Setup target repo cloned from temp test repo clone_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, clone_path) + self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=clone_path, errstream=errstream ) @@ -1521,7 +1521,7 @@ class PushTests(PorcelainTestCase): # Setup target repo cloned from temp test repo clone_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, clone_path) + self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True) target_repo = porcelain.init(clone_path) target_repo.close() @@ -1542,7 +1542,7 @@ class PushTests(PorcelainTestCase): # Setup target repo cloned from temp test repo clone_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, clone_path) + self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True) target_repo = porcelain.init(clone_path) target_repo.close() @@ -1589,7 +1589,7 @@ class PushTests(PorcelainTestCase): # Setup target repo cloned from temp test repo clone_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, clone_path) + self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=clone_path, errstream=errstream ) @@ -1631,7 +1631,7 @@ class PushTests(PorcelainTestCase): # Setup target repo cloned from temp test repo clone_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, clone_path) + self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=clone_path, errstream=errstream ) @@ -1717,7 +1717,7 @@ class PullTests(PorcelainTestCase): # Setup target repo self.target_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, self.target_path) + self.addCleanup(shutil.rmtree, self.target_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=self.target_path, errstream=BytesIO() ) @@ -2344,7 +2344,7 @@ class FetchTests(PorcelainTestCase): # Setup target repo target_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=target_path, errstream=errstream ) @@ -2391,7 +2391,7 @@ class FetchTests(PorcelainTestCase): # Setup target repo target_path = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, target_path) + self.addCleanup(shutil.rmtree, target_path, ignore_errors=True) target_repo = porcelain.clone( self.repo.path, target=target_path, errstream=errstream )