Просмотр исходного кода

Fix Repo leak in test_shallow_clone_from_git_is_identical

Jelmer Vernooij 3 недель назад
Родитель
Сommit
f5d1427254
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      tests/compat/server_utils.py

+ 5 - 3
tests/compat/server_utils.py

@@ -228,9 +228,11 @@ class ServerTests:
         )
 
         # compare the two clones; they should be equal
-        self.assertReposEqual(
-            Repo(self._stub_repo_git.path), Repo(self._stub_repo_dw.path)
-        )
+        repo_git = Repo(self._stub_repo_git.path)
+        self.addCleanup(repo_git.close)
+        repo_dw = Repo(self._stub_repo_dw.path)
+        self.addCleanup(repo_dw.close)
+        self.assertReposEqual(repo_git, repo_dw)
 
     def test_fetch_same_depth_into_shallow_clone_from_dulwich(self) -> None:
         require_git_version(self.min_single_branch_version)