Skip to content

Commit e7772b2

Browse files
bercedevsafishamsi
authored andcommitted
test(ingest): compare the symlink target against what readlink returned before (#4435)
On Windows readlink() returns the target as \\?\C:\..., so comparing it to the plain sentinel path failed three parameters of test_binary_captures_skip_existing_entries even though the capture left the link alone. Read the target right after creating the link and compare against that, which is what "untouched" means on every platform. (cherry picked from commit eb027be)
1 parent 9dfe132 commit e7772b2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/test_ingest_url_type.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def test_binary_captures_skip_existing_entries(entry_kind, numbered, tmp_path, m
161161
occupied.symlink_to(sentinel)
162162
except (OSError, NotImplementedError) as exc:
163163
pytest.skip(f"host cannot create symlinks: {exc}")
164+
# Windows reads the target back as \\?\C:\..., which never equals `sentinel`.
165+
link_target = occupied.readlink()
164166

165167
monkeypatch.setattr(ingest_mod, "validate_url", lambda url: url)
166168
monkeypatch.setattr(ingest_mod, "safe_fetch", lambda url: b"new capture")
@@ -176,7 +178,7 @@ def test_binary_captures_skip_existing_entries(entry_kind, numbered, tmp_path, m
176178
elif entry_kind == "directory":
177179
assert occupied.is_dir() and not list(occupied.iterdir())
178180
else:
179-
assert occupied.is_symlink() and occupied.readlink() == sentinel
181+
assert occupied.is_symlink() and occupied.readlink() == link_target
180182
if entry_kind == "live_link":
181183
assert sentinel.read_bytes() == b"outside sentinel"
182184
else:

0 commit comments

Comments
 (0)