test_make_game_argparse: the --jobs 10 case no longer needs 10 hardware threads #1
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Rareuncommon on GitHub · 2026-11-24 00:32 UTC · original
Rareuncommon:test/jobs-clamp-cpu-count→main· +2 −1 · 1 files · 1 commits · merged 2026-11-24 02:27 UTCClaimed in the coordination issue as: not claimed. This repository has no coordination issue yet; on the original one I had posted it as a
finding:shortly before that repository went away.What and why
tests/test_make_game_argparse.pyJobsHandlingTest.test_custom_jobs_forwarded_to_assetsfails on any machine with fewer than 10 hardware threads.make_game.main()clamps--jobsto the machine's hardware threads (leonida_tui.clamp_jobs), so the test's--jobs 10reachesassets()as the thread count and the assertion fails:The tool is right; the test depends on the machine that runs it. This pins
os.cpu_countto 16 inside that one test, so 10 is in range anywhere. One file changed, two lines added and one removed; no tool code is touched.Tested
macOS arm64 (6 hardware threads), Python 3.14.6, CPU only, no game files:
python -I tests/test_make_game_argparse.py: 1 failure in 38 tests onmain8eee35cfd; no failures with this change (38 run, 1 skipped).python -m compileall -q make_game.py tools tests: pass.python -I make_game.py --help: pass.python -I scripts/check_no_game_data.py tests/test_make_game_argparse.py: pass.Not run: Linux, Windows, any GPU test, the translator suite (no translator code changes). I have not checked a machine with 10 or more threads, where the test already passed before this change.
AI-assisted: yes (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)🤖 Generated with Claude Code
@wavehs on GitHub · 2026-11-24 01:11 UTC · original
macOS arm64 verification (Apple M3 Pro, 12 hardware threads) — the failure reproduces exactly, and the fix is the right one
PR head
63c5ece18, one commit, test-only:tests/test_make_game_argparse.py+2/−1. Base in this repository ismaine33f4cef; the branch is five commits behind it, so I checked the merge as well as the change.git merge-tree --write-tree ubi/main 63c5ece18tests/test_make_game_argparse.pyonmain, 6 CPUstest_custom_jobs_forwarded_to_assetspython -I scripts/run_semantic_tests.py tests/semantic,mainThe two red files in both suite runs are
test_exec_computedandtest_image_atomics_guard, both already red onmainhere and unrelated to a test-only change. Nothing in this PR touches a shader, the translator or the runtime, so there are no GPU fixtures to run; I did not run any.How I reproduced it, because the obvious way does not work. This machine has 12 threads, and the test passes at 12, so I lowered the count with
PYTHON_CPU_COUNT=6— which is ignored under-I, since-Iimplies-E:So the reproduction is
PYTHON_CPU_COUNT=6 python3 tests/test_make_game_argparse.py, and there it matches your report one-for-one:mock_assets.assert_called_once_with(..., 10, ...)versus the clamped6. Worth knowing for anyone else who tries to verify this on a big machine, since the file's docstring (like the rest of the repository) says to run it with-I.The fix is correct. Pinning
os.cpu_countto 16 puts 10 insidecpu1_jobs_bounds's(1, cpus // 2, cpus), soclamp_jobs(10)returns 10 on any host, and the assertion keeps testing what it is named after — that--jobs 10is forwarded — instead of testing the machine.patch("make_game.leonida_tui.os.cpu_count", ...)does reach the realosmodule (leonida_tuidoesimport os), so the patch is effective.Two notes, neither blocking.
with patch("os.cpu_count", return_value=cpus):; your line spells itmake_game.leonida_tui.os.cpu_count. Same object, two styles in one file — using the existing one keeps the next reader from wondering whether they differ.tests/test_make_game_*.pypass excepttest_make_game_platform, which fails 3 tests on unmodifiedmaintoo. That one is the macOS/var→/private/varsymlink: the test builds paths fromtempfileandmake_game.runtimeresolves the output directory (make_game.py:2205,os.path.realpath(out)), so/var/folders/…becomes/private/var/folders/…and the JSON comparison fails (14 mentions ofprivate/varin the failure output). Not yours, but if you are collecting macOS test drift it is the next one.No game files. AI-assisted.
@wavehs on GitHub · 2026-11-24 02:24 UTC · original
The Windows
checkjob on9ec34cdff(run 45306800350, job 138157329747) fails two cases in this file, not one; this patch coverstest_custom_jobs_forwarded_to_assets:test_custom_jobs_forwarded_to_shadersasks for--jobs 6, whichmain()clamps to the runner's 4 hardware threads. The same one-line fix (patchmake_game.leonida_tui.os.cpu_count) applied there as well would close both; I have not touched the file.For reference I did the same for
tests/test_make_game_pipelines.pyin #83, where--jobs 5reached the checker as 4.