Bladeren bron

Use GitFile when modifying packed-refs in tests.

Dave Borowitz 14 jaren geleden
bovenliggende
commit
84cc07d9c1
2 gewijzigde bestanden met toevoegingen van 9 en 2 verwijderingen
  1. 4 0
      NEWS
  2. 5 2
      dulwich/tests/test_repository.py

+ 4 - 0
NEWS

@@ -52,6 +52,10 @@
 
   * Clean up file headers. (Dave Borowitz)
 
+ TESTS
+
+  * Use GitFile when modifying packed-refs in tests. (Dave Borowitz)
+
  API CHANGES
 
   * dulwich.pack.write_pack_index_v{1,2} now take a file-like object

+ 5 - 2
dulwich/tests/test_repository.py

@@ -26,6 +26,9 @@ import tempfile
 import warnings
 
 from dulwich import errors
+from dulwich.file import (
+    GitFile,
+    )
 from dulwich.object_store import (
     tree_lookup_path,
     )
@@ -767,10 +770,10 @@ class DiskRefsContainerTests(RefsContainerTests, TestCase):
 
     def test_remove_packed_without_peeled(self):
         refs_file = os.path.join(self._repo.path, 'packed-refs')
-        f = open(refs_file)
+        f = GitFile(refs_file)
         refs_data = f.read()
         f.close()
-        f = open(refs_file, 'wb')
+        f = GitFile(refs_file, 'wb')
         f.write('\n'.join(l for l in refs_data.split('\n')
                           if not l or l[0] not in '#^'))
         f.close()