From 05997e2867b2abb826abf9e9a564e288302bce8c Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 4 Nov 2022 20:28:09 +0100 Subject: [PATCH] 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 --- 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 3f3018698..0a761af84 100644 --- a/src/borg/testsuite/hashindex.py +++ b/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