瀏覽代碼

Use os.path.samefile.

Jelmer Vernooij 4 年之前
父節點
當前提交
e81948a3a8
共有 2 個文件被更改,包括 8 次插入7 次删除
  1. 5 4
      dulwich/tests/compat/test_repository.py
  2. 3 3
      dulwich/tests/test_server.py

+ 5 - 4
dulwich/tests/compat/test_repository.py

@@ -182,16 +182,17 @@ class WorkingTreeTestCase(ObjectStoreTestCase):
         worktrees = self._parse_worktree_list(output)
         self.assertEqual(len(worktrees), self._number_of_working_tree)
         self.assertEqual(worktrees[0][1], '(bare)')
-        self.assertEqual(os.path.normcase(worktrees[0][0]),
-                         os.path.normcase(self._mainworktree_repo.path))
+        self.assertTrue(
+            os.path.samefile(worktrees[0][0], self._mainworktree_repo.path))
 
         output = run_git_or_fail(
             ['worktree', 'list'], cwd=self._mainworktree_repo.path)
         worktrees = self._parse_worktree_list(output)
         self.assertEqual(len(worktrees), self._number_of_working_tree)
         self.assertEqual(worktrees[0][1], '(bare)')
-        self.assertEqual(os.path.normcase(worktrees[0][0]),
-                         os.path.normcase(self._mainworktree_repo.path))
+        self.assertTrue(os.path.samefile(
+            worktrees[0][0],
+            self._mainworktree_repo.path))
 
 
 class InitNewWorkingDirectoryTestCase(WorkingTreeTestCase):

+ 3 - 3
dulwich/tests/test_server.py

@@ -1020,9 +1020,9 @@ class FileSystemBackendTests(TestCase):
 
     def test_absolute(self):
         repo = self.backend.open_repository(self.path)
-        self.assertEqual(
-            os.path.normcase(os.path.abspath(repo.path)),
-            os.path.normcase(os.path.abspath(self.repo.path)))
+        self.assertTrue(os.path.samefile(
+            os.path.abspath(repo.path),
+            os.path.abspath(self.repo.path)))
 
     def test_child(self):
         self.assertRaises(