Repository navigation
tests: the two write-failure cases in test_feature_scan need preexec_fn, which Windows does not have - #2667
Conversation
|
Independent Python 3.12 A/B with #2665. I merged #2665
Synthetic fixtures only. AI-assisted with OpenAI Codex. |
|
Rebased onto current
Verified after the rebase, on this branch: If #2633 merges first this second commit becomes a duplicate and can be dropped; if this lands first, #2633 becomes a no-op. Written with an AI assistant. |
|
Your "READ IN CODE" point turned out to be the most useful line in the review, and it needed a third commit: You noted that the CI selectors send this file through So the script run now loads the class explicitly: class_result = unittest.TextTestRunner(verbosity=0).run(
unittest.defaultTestLoader.loadTestsFromTestCase(FeatureScanAtomicOutputTests))
class_failed = len(class_result.failures) + len(class_result.errors)
ok = not failures and not raised and not class_failedMeasured here, in both invocation paths: So the class runs in the script path now, with its two Windows skips doing what the PR says, and the three Linux cases passing as your defaultTestLoader experiment predicted. What this says about the PR as a whole: it was fixing a failure that CI could not see and doing so in an invocation CI does not use. Thank you for reading the call site rather than just the diff - the change is now worth something where it matters. Written with an AI assistant. |
…s not have They fail on Windows today, and CI cannot see it because that file runs on Linux there: FeatureScanAtomicOutputTests' two "failed write" cases pass preexec_fn=fail_file_writes to subprocess, which is POSIX-only. Measured on main b8bd371, Windows 11, Python 3.13: 2 failed, 14 passed before; 14 passed, 2 skipped after, with the reason printed. On POSIX nothing changes. Written with an AI assistant.
The `__main__` scan collects the `test_*` globals, so the class's three methods never ran in the plain-script invocation CI uses - which means the two skips this PR adds never took effect there either. The class is loaded explicitly now. Measured here: the script run goes from 13 top-level tests to those plus "Ran 3 tests ... OK (skipped=2)", and pytest still reports 14 passed, 2 skipped. Written with an AI assistant.
463f759 to
0d94741
Compare
|
Re-verified after the rebase onto What I did not test: the rest of the change, and anything the rebase did not touch. This confirms the rebase kept the change working, not that the change is correct - that is what the review and the CI are for. Written with an AI assistant. |
|
VERIFY-2667 — PASS
|
No content change.
|
Independent check on Windows (not the author), at
So the PR does exactly what it says on Windows: gates the two POSIX-only cases instead of failing them. Coverage of the two write-failure paths is not exercised on this OS (they need fork/preexec), which is worth knowing but is the documented reason. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode). |
aslan2142
left a comment
There was a problem hiding this comment.
LGTM. Skipping the two POSIX-only preexec_fn write-failure tests on Windows and running FeatureScanAtomicOutputTests in tests/test_feature_scan.py's __main__ block fixes both Windows compatibility and silent skipping under python -I. Clean-room verified, 5/5 CI green, and independently verified. Merging.
(AI-assisted review.)
Two tests in
tests/test_feature_scan.pyfail on Windows and CI cannot see it, because that file runs on Linux there.Found while verifying #2665 - which is not the cause (the same two fail on
mainwithout it, and its only change to the file is a docstring line).The cause
FeatureScanAtomicOutputTests.run_scanpassesand
preexec_fnis POSIX-only. The two cases that use it (test_failed_write_keeps_existing_report,test_failed_write_leaves_no_temporary_file) therefore cannot run here at all - they die insubprocess.Popenbefore the tool is started.The change
Two decorators, one per case:
@unittest.skipIf(os.name == "nt", "preexec_fn, which these two cases need, is POSIX-only")The skip prints its reason, so the suite no longer reports a red that a Windows contributor cannot distinguish from their own breakage. On POSIX nothing changes: the decorator is a no-op there, and the cases run exactly as before.
What this does not do
It does not test the same behaviour on Windows. The intent of those cases - a failed write must leave the previous report intact and no temporary file behind - is real and worth covering;
preexec_fnis simply the POSIX way to inject the failure. A portable variant would make the destination unwritable instead (a directory where the file should go is enough), which would exercise the same intent on every platform. I did not write it because it tests a different failure point - after the tool opens its temp file rather than before - and that is a judgement for whoever owns this tool.A third commit the description above did not mention (
463f7593d)runtime.yml's selectors send eachtests/test_*.pythroughpython -I <file>unless it importspytestor definesHAVE_NUMPY =, and this file does neither. Its__main__scansglobals()for names starting withtest_, soFeatureScanAtomicOutputTestsnever ran in CI at all - which meant the two skips above had no effect there either.The script path now loads the class explicitly:
merzleckeier spotted the gap by reading the call site rather than the diff; the fix is mine, and it is the reason this change now protects something in the job that matters.
The extra commit at the tip (no longer carried)
The branch used to carry
a3b5ebea1(test(semantic): align computed-I/J f16 interp oracle…), added only becausesemantic-testswas red onmainfor that oracle and every branch cut frommaininherited it.mainnow has the same edit asc717967d0, so a rebase drops the commit and this pull request no longer touchestests/semantic/test_interp_computed_ij_fallback.py- the diff is only what this change actually needs.AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. Where and on what: the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it.
Written with an AI assistant.