From 11535b915ca6395f40199134183da3bfbc367a5b Mon Sep 17 00:00:00 2001 From: Felipe Fumero Date: Sat, 21 Nov 2026 18:11:35 -0600 Subject: [PATCH] test: compare resolved paths in the symlinked-root scan test The C54 containment test asserted an exact path string, but on Windows symlink resolution can return an extended-length (\\?\\) path, so the raw-string comparison failed there while the containment behaviour is correct. Compare os.path.realpath of both sides instead. Refs #711 --- changelog.d/+windows-symlink-path-test.infrastructure.md | 1 + test/unit/scan/test_folder.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelog.d/+windows-symlink-path-test.infrastructure.md 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)