diff --git a/changelog.d/+windows-symlink-path-test.infrastructure.md b/changelog.d/+windows-symlink-path-test.infrastructure.md new file mode 100644 index 00000000..0e68ddac --- /dev/null +++ b/changelog.d/+windows-symlink-path-test.infrastructure.md @@ -0,0 +1 @@ +Make the symlinked-root scan test compare resolved paths so it passes on Windows. diff --git a/test/unit/scan/test_folder.py b/test/unit/scan/test_folder.py index d887eab8..347229af 100644 --- a/test/unit/scan/test_folder.py +++ b/test/unit/scan/test_folder.py @@ -9,6 +9,7 @@ ###################################################################### from __future__ import annotations +import os import platform from pathlib import Path @@ -75,6 +76,8 @@ def test_make_full_path_accepts_internal_link_and_symlinked_root(tmp_path): root_link = tmp_path / 'root-link' root_link.symlink_to(root, target_is_directory=True) - assert LocalFolder(root_link).make_full_path('link/new-file.txt') == str( - root_link / 'link' / 'new-file.txt' - ) + result = LocalFolder(root_link).make_full_path('link/new-file.txt') + expected = str(root_link / 'link' / 'new-file.txt') + # On Windows, symlink resolution can return an extended-length ("\\?\\") path, + # so compare the resolved real paths rather than the raw strings. + assert os.path.realpath(result) == os.path.realpath(expected)