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
9 changes: 9 additions & 0 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,15 @@ def __str__(self):
return "%s(name='%s', prefix='%s')" % (type(self).__name__,
self.name, self.prefix)

def __eq__(self, other):
if not isinstance(other, RegressionTest):
return NotImplemented

return self.name == other.name

def __hash__(self):
return hash(self.name)


class RunOnlyRegressionTest(RegressionTest, special=True):
'''Base class for run-only regression tests.
Expand Down
18 changes: 18 additions & 0 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ def _container_exec_ctx(platform):
return _container_exec_ctx


def test_eq():
class T0(rfm.RegressionTest):
def __init__(self):
self.name = 'T0'

class T1(rfm.RegressionTest):
def __init__(self):
self.name = 'T0'

t0, t1 = T0(), T1()
assert t0 == t1
assert hash(t0) == hash(t1)

t1.name = 'T1'
assert t0 != t1
assert hash(t0) != hash(t1)


def test_environ_setup(hellotest, local_exec_ctx):
# Use test environment for the regression check
hellotest.variables = {'_FOO_': '1', '_BAR_': '2'}
Expand Down