Skip to content

Commit 32813e5

Browse files
committed
testsuite: only use follow_symlinks if supported
On Windows, follow_symlinks is not supported by every os function yet, using False can raise a NotImplementedError. Check os.supports_follow_symlinks to decide whether to use True or False.
1 parent 1c8da8f commit 32813e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/borg/testsuite/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def is_utime_fully_supported():
147147
else:
148148
open(filepath, "w").close()
149149
try:
150-
os.utime(filepath, (1000, 2000), follow_symlinks=False)
151-
new_stats = os.stat(filepath, follow_symlinks=False)
150+
os.utime(filepath, (1000, 2000), follow_symlinks=False if os.utime in os.supports_follow_symlinks else True)
151+
new_stats = os.stat(filepath, follow_symlinks=False if os.stat in os.supports_follow_symlinks else True)
152152
if new_stats.st_atime == 1000 and new_stats.st_mtime == 2000:
153153
return True
154154
except OSError:

0 commit comments

Comments
 (0)