Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Fix error in fixture resolution when multiple fixtures of the same class are instantiated with different variables #3326

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,9 @@ def _resolve_fixtures(self):
# registered under the same fixture class. So the loop below must
# also inspect the fixture data the instance was registered with.
for fixt_name, fixt_data in registry[f.cls].items():
if f.scope != fixt_data.scope:
if fixt_data.variables != f.variables:
continue
elif f.scope != fixt_data.scope:
continue
elif fixt_data.variant_num not in target_variants:
continue
Expand Down
14 changes: 14 additions & 0 deletions unittests/resources/checks_unlisted/fixtures_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,17 @@ def validate_fixture_resolution(self):
ParamFixture.num_variants
)
])


@rfm.simple_test
class TestC(rfm.RunOnlyRegressionTest):
valid_systems = ['*']
valid_prog_environs = ['*']
executable = 'echo'
f0 = fixture(SimpleFixture, scope='environment', variables={'data': 10})
f1 = fixture(SimpleFixture, scope='environment', variables={'data': 20})

@sanity_function
def validate_vars(self):
return sn.all([sn.assert_eq(self.f0.data, 10),
sn.assert_eq(self.f1.data, 20)])
Loading