瀏覽代碼

Fix test_size_on_disk_accurate on Windows

Pass the python file object / fd 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
Thomas Waldmann 2 年之前
父節點
當前提交
05997e2867
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/borg/testsuite/hashindex.py

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

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