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

test_file.GitFileTests.test_abort_close_removed: close lockfile before removing it

Prevents a WindowsError when calling os.remove() on the lockfile.
Tay Ray Chuan пре 14 година
родитељ
комит
555255aff8
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      dulwich/tests/test_file.py

+ 3 - 0
dulwich/tests/test_file.py

@@ -197,6 +197,9 @@ class GitFileTests(TestCase):
     def test_abort_close_removed(self):
     def test_abort_close_removed(self):
         foo = self.path('foo')
         foo = self.path('foo')
         f = GitFile(foo, 'wb')
         f = GitFile(foo, 'wb')
+
+        f._file.close()
         os.remove(foo+".lock")
         os.remove(foo+".lock")
+
         f.abort()
         f.abort()
         self.assertTrue(f._closed)
         self.assertTrue(f._closed)