Skip to content

test[cartesian]: un-shadow the duplicate test_enum_runtime - #2872

Open
Anai-Guo wants to merge 1 commit into
GridTools:mainfrom
Anai-Guo:fix/unshadow-test-enum-runtime
Open

test[cartesian]: un-shadow the duplicate test_enum_runtime#2872
Anai-Guo wants to merge 1 commit into
GridTools:mainfrom
Anai-Guo:fix/unshadow-test-enum-runtime

Conversation

@Anai-Guo

Copy link
Copy Markdown

Summary

test_enum_runtime is defined twice at module level in
tests/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_runtime and the first definition is silently
dropped and never runs.

The first (shadowed) definition is the one that actually exercises the
@gtscript.enum MyEnum runtime 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: bool parameter and tests a boolean
runtime argument, so it is really a separate test that was mis-named. This PR
renames it to test_bool_runtime so both tests are collected and run.

Verification

AST scan of the file:

total module-level test_ defs unique names (pytest collects)
before 60 59 (test_enum_runtime duplicated)
after 60 60

Change is a single-line rename; no test logic is modified.

🤖 Generated with Claude Code

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant