浏览代码

Attempt to fix tests on Python 3.13 on Windows

Jelmer Vernooij 6 月之前
父节点
当前提交
042d84a112
共有 2 个文件被更改,包括 10 次插入4 次删除
  1. 4 1
      tests/test_index.py
  2. 6 3
      tests/test_object_store.py

+ 4 - 1
tests/test_index.py

@@ -525,7 +525,10 @@ class BuildIndexTests(TestCase):
 
             tree = Tree()
             latin1_name = "À".encode("latin1")
-            latin1_path = os.path.join(repo_dir_bytes, latin1_name)
+            try:
+                latin1_path = os.path.join(repo_dir_bytes, latin1_name)
+            except UnicodeDecodeError:
+                self.skipTest("can not decode as latin1")
             utf8_name = "À".encode()
             utf8_path = os.path.join(repo_dir_bytes, utf8_name)
             tree[latin1_name] = (stat.S_IFREG | 0o644, file.id)

+ 6 - 3
tests/test_object_store.py

@@ -219,11 +219,14 @@ class DiskObjectStoreTests(PackBasedObjectStoreTests, TestCase):
     def test_add_alternate_path(self):
         store = DiskObjectStore(self.store_dir)
         self.assertEqual([], list(store._read_alternate_paths()))
-        store.add_alternate_path("/foo/path")
-        self.assertEqual(["/foo/path"], list(store._read_alternate_paths()))
+        store.add_alternate_path(os.path.abspath("/foo/path"))
+        self.assertEqual(
+            [os.path.abspath("/foo/path")], list(store._read_alternate_paths())
+        )
         store.add_alternate_path("/bar/path")
         self.assertEqual(
-            ["/foo/path", "/bar/path"], list(store._read_alternate_paths())
+            [os.path.abspath("/foo/path"), "/bar/path"],
+            list(store._read_alternate_paths()),
         )
 
     def test_rel_alternative_path(self):