1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-25 15:33:39 +00:00

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
This commit is contained in:
Rayyan Ansari 2022-11-04 18:20:28 +00:00
parent 7aeae7cf7a
commit cc0ad321dc

View file

@ -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