Skip to content

Commit 939d60e

Browse files
committed
test: Pass strings to readlink for Windows Python 3.7
The dangling-metadata regression passed pathlib.Path objects to os.readlink() when capturing and checking the symlink target. Windows Python 3.7 requires a string argument, so all four parameter combinations failed with TypeError before exercising the clone fix. Convert the path to str at both calls. The production clone helper already passes a string and needs no change. Keep the target-preservation assertions and the absolute/relative and realpath-mode coverage intact. Validation: reproduced all four TypeErrors on Windows/Python 3.10 with an in-memory readlink wrapper enforcing the Python 3.7 string requirement. After the conversions, all four cases passed with the same wrapper and Windows permission-error suppression disabled. Ruff 0.16.5 lint and formatting checks and git diff --check passed. Native Python 3.7 was not available locally.
1 parent 4f18c15 commit 939d60e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test/test_submodule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,12 @@ def test_add_to_dangling_metadata_symlink(movable_submodule, tmp_path, metadata_
457457
link = Path(sm.repo.git_dir) / "modules/new"
458458
target = tmp_path / "missing" / "metadata"
459459
link.symlink_to(osp.relpath(target, link.parent) if relative_target else target, target_is_directory=True)
460-
link_target = os.readlink(link)
460+
link_target = os.readlink(str(link))
461461

462462
added = Submodule.add(sm.repo, "new", "new", sm.url)
463463

464464
assert link.is_symlink() and link.is_dir()
465-
assert os.readlink(link) == link_target
465+
assert os.readlink(str(link)) == link_target
466466
assert (target / "HEAD").is_file()
467467
with added.module() as module:
468468
assert Path(module.git_dir).resolve() == target.resolve()

0 commit comments

Comments
 (0)