fix(#48): compare hygiene-gate cwd as a Path, not a string (Windows review box)
Review 11154: the test asserted the workspace directory as the literal
string "/fake/ws", but on Windows str(Path('/fake/ws')) is '\\fake\\ws' —
a valid spelling of the same directory when passed as a subprocess cwd.
Compare the recorded cwd as paths (Path(ws_dir) == Path('/fake/ws')) so the
assertion holds on every platform. Test-only change: passing a Path as cwd
is correct and remains untouched; no production code change.
Confirmed for the review's open question: the workspace directory is never
string-concatenated into a command — reviewer.py passes ws.dir only as the
cwd argument to Runner.run (for pytest, build_cmd, and the
["git","diff","--check", base, "HEAD"] hygiene list). The only string
containing self.dir is the MergeWorkspace __repr__ debug aid.
Tests: full suite 236 passed, 1 skipped; git diff --check clean.
This commit is contained in:
parent
3d3e592832
commit
6326199966
@ -345,7 +345,12 @@ def test_hygiene_diff_check_uses_explicit_base_head_range():
|
||||
# workspace directory — never a bare `git diff --check`.
|
||||
assert len(runner.commands) == 2 # pytest + explicit-range diff --check
|
||||
ws_dir, hygiene_cmd, _ = runner.commands[1]
|
||||
assert ws_dir == "/fake/ws"
|
||||
# Compare as PATHs, not strings: on Windows str(Path('/fake/ws')) is
|
||||
# '\\fake\\ws' (a valid spelling of the same directory) — the string
|
||||
# comparison would fail on the platform this gate actually runs on.
|
||||
# Fix in the test, not the source: passing a Path as cwd is correct
|
||||
# (bounce-fix review 11154; issue #48).
|
||||
assert Path(ws_dir) == Path("/fake/ws")
|
||||
# The whitespace gate runs as an ARGUMENT LIST (shell=False) — no shell
|
||||
# can mangle the SHA/HEAD tokens on any platform (issue #48).
|
||||
assert hygiene_cmd == ["git", "diff", "--check",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user