mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-17 17:39:44 +00:00
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 eb027be627)
This commit is contained in:
1 parent
9dfe13254f
commit
e7772b2d18
1 file changed
+3
-1
@@ -161,6 +161,8 @@ def test_binary_captures_skip_existing_entries(entry_kind, numbered, tmp_path, m
|
||||
occupied.symlink_to(sentinel)
|
||||
except (OSError, NotImplementedError) as exc:
|
||||
pytest.skip(f"host cannot create symlinks: {exc}")
|
||||
# Windows reads the target back as \\?\C:\..., which never equals `sentinel`.
|
||||
link_target = occupied.readlink()
|
||||
|
||||
monkeypatch.setattr(ingest_mod, "validate_url", lambda url: url)
|
||||
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
|
||||
elif entry_kind == "directory":
|
||||
assert occupied.is_dir() and not list(occupied.iterdir())
|
||||
else:
|
||||
assert occupied.is_symlink() and occupied.readlink() == sentinel
|
||||
assert occupied.is_symlink() and occupied.readlink() == link_target
|
||||
if entry_kind == "live_link":
|
||||
assert sentinel.read_bytes() == b"outside sentinel"
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user