Browse Source

Fix test_size_on_disk_accurate on Windows

Pass the file descriptor instead of the file path.
On Windows, a tempfile cannot be opened again, unlike on Unix systems.
See https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile
Rayyan Ansari 2 years ago
parent
commit
cc0ad321dc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/borg/testsuite/hashindex.py

+ 1 - 1
src/borg/testsuite/hashindex.py

@@ -259,7 +259,7 @@ class HashIndexSizeTestCase(BaseTestCase):
         for i in range(1234):
             idx[H(i)] = i, i**2
         with tempfile.NamedTemporaryFile() as file:
-            idx.write(file.name)
+            idx.write(file)
             size = os.path.getsize(file.name)
         assert idx.size() == size