test(blocking-io): compare the emitted path portably (#6427)

test_json_output_uses_concise_review_record_schema asserts the JSON record
against str(source_file). The detector builds location.path through
relative_to_repo, which is as_posix() on both of its branches, so on POSIX the
two strings are equal and the assertion holds. On Windows str(path) yields
backslashes, so the test fails against output that is behaving as documented.

One word: str(source_file) becomes source_file.as_posix(). On POSIX the two are
the same string, so this is a no-op for CI; on Windows it makes the assertion
match what the detector emits. Every other path field in the repository is
written with as_posix() as well.

Before: 1 failed, 50 passed. After: 51 passed, on Windows with Python 3.12.
The three sibling detector suites still pass (35 passed), and ruff check and
ruff format --check pass on the file.
This commit is contained in:
PerryLink 2026-10-07 18:22:15 +08:00 committed by GitHub
parent f0476677de
commit c7b65c5c36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,7 +246,7 @@ def test_json_output_uses_concise_review_record_schema(tmp_path: Path, capsys) -
{
"priority": "HIGH",
"location": {
"path": str(source_file),
"path": source_file.as_posix(),
"line": 4,
"column": 5,
"function": "handler",