From cc0ad321dc32b78ce2f2f625ae91040fddf3fd8c Mon Sep 17 00:00:00 2001 From: Rayyan Ansari Date: Fri, 4 Nov 2022 18:20:28 +0000 Subject: [PATCH] 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 --- src/borg/testsuite/hashindex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/testsuite/hashindex.py b/src/borg/testsuite/hashindex.py index d4fc908e0..3f3018698 100644 --- a/src/borg/testsuite/hashindex.py +++ b/src/borg/testsuite/hashindex.py @@ -259,7 +259,7 @@ def test_size_on_disk_accurate(self): 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