test[cartesian]: un-shadow the duplicate test_enum_runtime - #2872
Open
Anai-Guo wants to merge 1 commit into
Open
test[cartesian]: un-shadow the duplicate test_enum_runtime#2872Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
test_enum_runtime is defined twice at module level in test_code_generation.py (L1868 and L1896). Python keeps only the last binding, so pytest collects a single test and the first definition -- the one that actually exercises the @gtscript.enum MyEnum runtime parameter (enum comparison and multi-interval enum assignment) -- is silently dropped and never runs. The second definition takes a bool parameter (done: bool) and tests a boolean runtime argument, so it is really a separate test that was mis-named. Rename it to test_bool_runtime so both tests are collected and run. AST check on the file: 60 module-level test_ defs but only 59 unique names before; 60 unique after the rename.
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.
Summary
test_enum_runtimeis defined twice at module level intests/cartesian_tests/integration_tests/multi_feature_tests/test_code_generation.py(L1868 and L1896). Since Python keeps only the last binding of a name, pytest
collects a single
test_enum_runtimeand the first definition is silentlydropped and never runs.
The first (shadowed) definition is the one that actually exercises the
@gtscript.enum MyEnumruntime parameter — enum comparison (order < MyEnum.A)and multi-interval enum assignment, asserting the output equals
MyEnum.A/B/C.value. That coverage is currently lost.The second definition takes a
done: boolparameter and tests a booleanruntime argument, so it is really a separate test that was mis-named. This PR
renames it to
test_bool_runtimeso both tests are collected and run.Verification
AST scan of the file:
test_defstest_enum_runtimeduplicated)Change is a single-line rename; no test logic is modified.
🤖 Generated with Claude Code