Repository navigation
tests: run all test classes under the standard python -I invocation - #6372
Open
NethminaYasas wants to merge 1 commit into
Open
NethminaYasas wants to merge 1 commit into
NethminaYasas wants to merge 1 commit into
Conversation
CarveUntilAdatTest, TexelOffsetFormsChecks and PixelTestRegistry were defined below the guard, so seven tests never ran under the project's standard 'python -I tests/<name>.py' command (17/20 and 82/86 before). Move both guards to the end of their files and add an AST meta-test that fails when a test class is defined below a guard.
1 task done
NethminaYasas
marked this pull request as ready for review
November 23, 2026 14:21
|
Tested 0d91eff on Windows 11 (NTFS), Python 3.12.10 (CPU only, no GPU, no game files): pass What I ran:
Not caused by this PR: on current Nits, none blocking:
Overlap: #3236 (Tests: define PixelTestRegistry and CarveUntilAdatTest before main) is still open. It does part of the same change, misses AI-assisted (Claude Code). |
Contributor
Author
|
thanks @AsgerCode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: under the project's standard
python -I tests/<name>.pycommand, seven tests never ran.CarveUntilAdatTestintests/test_rpf9_carve.pyandTexelOffsetFormsChecks/PixelTestRegistryintests/test_shader_checks.pyare defined below an earlyunittest.main()guard. Those files ran 17/20 and 82/86 tests; the missing seven only appeared underunittest discover, so CI's standard-library step did not check them. Reported as finding 7101672279 on #5934.Fix: move both guards to the end of their files (no test logic changed) and add
tests/test_unittest_main_guard.py, an AST scan that fails when aunittest.TestCaseclass is defined below a guard. It recognisesunittest.main(argv=...), multi-statement blocks and wrapped calls, and does not mistake a string mention for a call.Tests:
python -I tests/test_rpf9_carve.py: 20 passed (17 before)python -I tests/test_shader_checks.py: 86 passed (82 before)python -I tests/test_unittest_main_guard.py: 5 passed; on unmodified upstream it fails and names all three hidden classespython -m compileall -q make_game.py tools tests: exit 0python -m pytest -q tests/test_unittest_main_guard.py tests/test_rpf9_carve.py tests/test_shader_checks.py tests/test_ci_registration.py: 125 passed, 330 subtests passedHow to verify: run the three
python -Icommands and compare withpython -m unittest <module>(20/20 and 86/86).CodeRabbit: 0 findings on the final commit (
coderabbit review --agent --committed --base upstream/main --fresh), 3 files reviewed.CI is queued behind the repo-wide backlog; all local checks pass.
Related: #3236 touches the same two files but is open with merge conflicts and predates
TexelOffsetFormsChecks; this PR supersedes it and the maintainer can decide whether to close #3236.Board issue: #5934 (claim at #5934 (comment)).
AI-assisted: yes. Tested on Windows with Python 3.14.6, CPU only; no game files, no GPU or driver-specific behavior.