Repository navigation
test_calibrated_texture_extra: patch ct.replace_retry so the #570 test works without numpy - #2101
Conversation
…d_texture holds
Without numpy the test loads calibrated_texture inside mock.patch.dict(sys.modules),
which drops replace_retry from sys.modules again on exit. mock.patch("replace_retry.replace")
then imports and patches a second copy, export_file never sees the failure, and the
test added in ProjectLeonida#570 fails. Patch ct.replace_retry directly, which is the same module
with or without numpy.
|
Note 🤖 gpt-6.2-sol responding on behalf of EdenBendheim Independent verification of head
This also resolves one of the two pre-existing failures in the full standalone test run for #2193. No defects found. |
|
Note 🤖 AI-assisted (MiniMax Code, MiniMax-M3.1-Flash) — CPU-only verification run on a local Windows machine. These suites mock Independent Windows verification of head Environment: Windows 11 (10.0.29712 SP0), AMD64, CPython 3.13.17, no NumPy ( Why this leg matters: the Measured, same command in both cases (
The single main failure is Why it fails, confirmed by direct probe on this tree:
I had derived this same one-line fix on my own tree before finding this PR, so this is a confirmation rather than a new proposal — the change matches what I measured and is correct as written. No defects found in it. Caveat: the local interpreter is CPython 3.13.17 while the |
|
Verified independently on Before (unmodified main): After: Cause confirmed: without the patch, Negative control: with This matters for CI, not only locally: the AI-assisted (verification run only). |
|
I reproduced the failure on native Windows with CPython 3.13.14 and no NumPy. On AI-assisted testing. |
Claimed in the coordination issue as: #1608 (comment)
What and why
#570 added
test_export_file_replacement_failure_cleans_temporary_filetotests/test_calibrated_texture_extra.py. It fails onmaindb1a22d29wherever numpy isn't installed (OSError not raised).Without numpy,
_load_calibrated_texture()runscalibrated_texture.pyinsidemock.patch.dict(sys.modules, {"numpy": fake_np}). On exit,patch.dictrestoressys.modules, which also removesreplace_retry, imported during that load. The test patchesmock.patch("replace_retry.replace", ...), which imports and patches a fresh copy ofreplace_retry.ct.replace_retryis still the old one, soexport_filereplaces the file normally and nothing raises. Checked: with the fake numpy,ct.replace_retry is sys.modules["replace_retry"]isFalse.The test now patches
mock.patch.object(ct.replace_retry, "replace", ...), which is the moduleexport_filecalls, with or without numpy.tools/calibrated_texture.pyis unchanged.Tested
Apple M4, macOS 26.5.1, Python 3.14.8 and 3.12.10 (neither has numpy, so the stdlib shim path is used), CPU only, no game files.
tests/test_calibrated_texture_extra.py: the test fails onmaindb1a22d29. With this change, all 30 tests OK on both versions.tmp.unlink(...)cleanup inexport_fileremoved, the test fails again, so it still checks the cleanup.python -m compileall,git diff --checkandscripts/check_no_game_data.pyon the changed file: clean.GPUs tested: n/a (no GPU tests involved)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule changes)