From c7b65c5c3633c291bc96d1ad14e30e404a3370d1 Mon Sep 17 00:00:00 2001 From: PerryLink Date: Wed, 7 Oct 2026 18:22:15 +0800 Subject: [PATCH] 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. --- backend/tests/test_detect_blocking_io_static.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/tests/test_detect_blocking_io_static.py b/backend/tests/test_detect_blocking_io_static.py index 142f02e7d1..9985b7099f 100644 --- a/backend/tests/test_detect_blocking_io_static.py +++ b/backend/tests/test_detect_blocking_io_static.py @@ -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",