HAVE_NUMPY used importlib.util.find_spec in this process, while the tests run
the tool with python -I, which hides the --user install this machine has. The
gate opened and four cases died on "needs numpy" instead of testing what they
name. The file already did this correctly for Pillow (HAVE_PIL_ISOLATED); this
applies the same probe to numpy and gates the four cases that reach it, keeping
the eleven that test behaviour before numpy.
Measured on main b8bd37111, Windows 11, Python 3.13: 5 failed, 12 passed before;
11 passed, 4 skipped after. Where -I sees numpy the probe returns true and the
four run as before.
Written with an AI assistant.
Twelve test files failed on main at 2d53a8055 (CI's check and semantic-tests steps, run locally): most are a test
and the code it checks changed by different pull requests in the same merge round. Each fix below is either taken
from a closed pull request that already had it, or restores what an earlier merged change intended.
From closed pull requests:
- test_make_game_resume: FakeProc gets poll(), which translate() now calls (#7018)
- test_make_game_empty_translation: the Exited stub gets poll() and the failed-shard path is checked (#7214)
- test_shader_checks: stub table_fetch_test in the Wave64Checks harness and count it (#7433)
- test_runtime_paths: runtime.yml's path filter lists tools/replace_retry.py, which rdna2spirv.py imports (#7029)
- test_psin_names: patch the same_report_path helpers that report_paths now calls (#8719)
- test_report_source_collision: the fixture is a real Bink 2 header; bink_index refuses other files (#7408)
- test_missing_input_exit_codes: tile_probe checks its inputs before it asks for numpy (#4771)
Restored:
- merge_check: a failed `git show` is an error again (5b88d58); 21016cf brought back the lenient read that
treated it as a new file, while new files are already left out when the diff is read
- rpf_probe: a symlinked --out updates its target again (44d3595); 55d21cc's staged write replaced the link
Updated to the code:
- test_shader_stage_resume: TRANSLATION_SOURCES lists fssm_unpack.py and shader_stage_manifest.py, which the
translator imports; existing work folders translate once more after this
- test_tool_stdout_encoding: the 15 programs merged without the stdout guard get the same block as the others
- test_rdna2spirv_decode: drop the test of decode_any_format, which SHADER-849 replaced with the table decode
that tests/semantic/test_format_decode_table.py checks
Co-authored-by: jewmaster1337 <102986566+jewmaster1337@users.noreply.github.com>
Co-authored-by: TanmaySatyam <248538550+TanmaySatyam@users.noreply.github.com>
Co-authored-by: evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com>
Co-authored-by: slint6614-dev <359954236+slint6614-dev@users.noreply.github.com>
Co-authored-by: BlackNife <108077267+Poussistar@users.noreply.github.com>
Co-authored-by: fiestorra <65175643+fiestorra@users.noreply.github.com>
Co-authored-by: fearkov <289226582+fearkov@users.noreply.github.com>
Co-authored-by: DoubleD17 <48109637+DoubleD17@users.noreply.github.com>
Eleven tools treated a nonexistent input folder as a failed run (1). They now print one ERROR line and return 2, while real read failures keep exit 1. image_query_probe imports the hardware oracle only for a GPU run, so --help stays prompt. A table-driven subprocess test covers all eleven; existing expectations are updated.
`--out` is written by PIL with no checks: pointing it at the blob being probed
opened the sample for the read and then saved the preview over it, truncating
the very bytes the probe had just read (`tile_probe shot.bin --out shot.bin`
leaves shot.bin as a PNG). A folder that did not exist was a PIL traceback
after the whole probe had already run, and a Pillow install in the --user
site is invisible to the documented `python -I` invocation, which was a
ModuleNotFoundError from inside render() at the same late point.
The path checks now run before the read: refuse a directory, refuse the input
(realpath plus samefile, so a different spelling of the same file is caught),
create the preview's folder, and give Pillow's absence one line at render
time. amd_swizzle imports the same helper for its own preview.
When every candidate was rejected (a sample shorter than 16 rows of blocks at
any of the widths) main() printed nothing, wrote no preview and returned 0, so
a script saw a successful run with no result. The empty-file and bad-offset
paths already exit 1, and tools/swizzle_search.py treats the same outcome as
one ERROR line, so match it: name the input and offset, exit 1.
Tests: an 8-byte and a 4 KiB blob, with and without --out, must exit 1, print
one line naming the file, and leave no preview; the 16 KiB case still probes
and exits 0.
Negative control on main: both new subtests fail (exit 0, no message). With
the change: 5/5. No game data.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
A missing file stopped with a traceback. A negative --offset silently probed the last bytes of the file
(Python slicing from the end), and an offset at or past the end printed nothing and exited 0, which looks like
"no layout found". Both now exit 1 with the offset and the file size; an empty file reports 0 bytes.
Tests: tests/test_tile_probe.py (new; skips without numpy, which the tool needs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>