Преглед изворни кода

Attempt to fix index test on Mac OS X.

Jelmer Vernooij пре 4 година
родитељ
комит
10d3aa4162
2 измењених фајлова са 10 додато и 16 уклоњено
  1. 2 13
      dulwich/index.py
  2. 8 3
      dulwich/tests/test_index.py

+ 2 - 13
dulwich/index.py

@@ -560,19 +560,8 @@ def build_index_from_tree(root_path, index_path, object_store, tree_id,
             # TODO(jelmer): record and return submodule paths
         else:
             obj = object_store[entry.sha]
-            try:
-                st = build_file_from_blob(
-                    obj, entry.mode, full_path, honor_filemode=honor_filemode)
-            except OSError as e:
-                if e.errno == 92 and sys.platform == 'darwin':
-                    # Our filename isn't supported by the platform :(
-                    import warnings
-                    warnings.warn(
-                        'Unable to write file %s: %s' %
-                        (full_path, e.strerror))
-                    continue
-                else:
-                    raise
+            st = build_file_from_blob(
+                obj, entry.mode, full_path, honor_filemode=honor_filemode)
 
         # Add file to index
         if not honor_filemode or S_ISGITLINK(entry.mode):

+ 8 - 3
dulwich/tests/test_index.py

@@ -526,9 +526,14 @@ class BuildIndexTests(TestCase):
                 # It implicitly decodes using utf8, which doesn't work.
                 self.skipTest('can not implicitly convert as utf8')
 
-            build_index_from_tree(
-                repo.path, repo.index_path(),
-                repo.object_store, tree.id)
+            try:
+                build_index_from_tree(
+                    repo.path, repo.index_path(),
+                    repo.object_store, tree.id)
+            except OSError as e:
+                if e.errno == 92 and sys.platform == 'darwin':
+                    # Our filename isn't supported by the platform :(
+                    self.skipTest('can not write filename %r' % e.filename)
 
             # Verify index entries
             index = repo.open_index()