diff --git a/changelog.d/+windows-symlink-path-expectation.infrastructure.md b/changelog.d/+windows-symlink-path-expectation.infrastructure.md new file mode 100644 index 00000000..1d052516 --- /dev/null +++ b/changelog.d/+windows-symlink-path-expectation.infrastructure.md @@ -0,0 +1 @@ +Account for the Windows long-path prefix when checking paths through internal symlinks and symlinked local roots in the unit tests. diff --git a/test/unit/scan/test_folder.py b/test/unit/scan/test_folder.py index 41b33bec..03868ba5 100644 --- a/test/unit/scan/test_folder.py +++ b/test/unit/scan/test_folder.py @@ -17,6 +17,7 @@ from b2sdk._internal.scan.exception import UnsupportedFilename from b2sdk._internal.scan.folder import LocalFolder +from b2sdk._internal.utils import fix_windows_path_limit @pytest.mark.skipif( @@ -78,8 +79,8 @@ def test_make_full_path_accepts_internal_link_and_symlinked_root(tmp_path): result = LocalFolder(root_link).make_full_path('link/new-file.txt') expected = str(root_link / 'link' / 'new-file.txt') - # Windows symlink resolution can add an extended-length ("\\?\\") prefix that - # realpath does not normalize away, so compare by filesystem identity of the - # (existing) parent directory plus the file name instead of raw strings. + assert result == fix_windows_path_limit(expected) + # Also check the existing parent by filesystem identity: realpath alone + # does not normalize away the Windows extended-length prefix. assert os.path.basename(result) == os.path.basename(expected) == 'new-file.txt' assert os.path.samefile(os.path.dirname(result), os.path.dirname(expected))