Skip to content
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
2 changes: 1 addition & 1 deletion reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ def hashcode(self):
return self._rfm_hashcode

m = hashlib.sha256()
if self.is_fixture:
if self.is_fixture():
m.update(self.unique_name.encode('utf-8'))
else:
basename, *params = self.display_name.split(' %')
Expand Down
4 changes: 3 additions & 1 deletion unittests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def test_have_any_name_param_test(sample_param_cases):
sample_param_cases)
assert 0 == count_checks(filters.have_any_name(['_X@12']),
sample_param_cases)
assert 2 == count_checks(filters.have_any_name(['/023313dc', '/efddbc6c']),

# The /0951c7ff selects two tests as they both have x=1
assert 3 == count_checks(filters.have_any_name(['/0951c7ff', '/37e9e1c6']),
sample_param_cases)
assert 2 == count_checks(filters.have_any_name(['_X@0', '_X@1']),
sample_param_cases)
Expand Down
27 changes: 27 additions & 0 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,33 @@ def set_defaults(self):
assert x.bar == 100


def test_hashcode():
# We always redefine _X0 here so that the test gets always the same base
# name (class name) and only the parameter values should change. We then
# use aliases to access the various definitions for our assertions.

class _X0(rfm.RunOnlyRegressionTest):
p = parameter([1])

class _X0(rfm.RunOnlyRegressionTest):
p = parameter([2])

_X1 = _X0

class _X0(rfm.RunOnlyRegressionTest):
p = parameter([1, 2])

_X2 = _X0

t0 = _X0(variant_num=0)
t1 = _X1(variant_num=0)
t2, t3 = (_X2(variant_num=i) for i in range(_X2.num_variants))

assert t0.hashcode != t1.hashcode
assert t2.hashcode == t0.hashcode
assert t3.hashcode == t1.hashcode


def test_variables_deprecation():
with pytest.warns(ReframeDeprecationWarning):
class _X(rfm.RunOnlyRegressionTest):
Expand Down