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
11 changes: 11 additions & 0 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ def disable_hook(cls, hook_name):
'''
cls._rfm_disabled_hooks.add(hook_name)

@classmethod
def pipeline_hooks(cls):
ret = {}
for c in cls.mro():
if hasattr(c, '_rfm_pipeline_hooks'):
for kind, hook in c._rfm_pipeline_hooks.items():
ret.setdefault(kind, [])
ret[kind] += hook

return ret

#: The name of the test.
#:
#: :type: string that can contain any character except ``/``
Expand Down
2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def fmt_deps():
'Node allocation': node_alloc_scheme,
'Pipeline hooks': {
k: fmt_list(fn.__name__ for fn in v)
for k, v in type(check)._rfm_pipeline_hooks.items()
for k, v in check.pipeline_hooks().items()
},
'Tags': fmt_list(check.tags),
'Valid environments': fmt_list(check.valid_prog_environs),
Expand Down
4 changes: 4 additions & 0 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ class MyTest(DerivedTest):
_run(test, *local_exec_ctx)
assert test.var == 2
assert test.foo == 1
assert test.pipeline_hooks() == {
'post_setup': [DerivedTest.z, BaseTest.x],
'pre_run': [C.y],
}


def test_overriden_hooks(local_exec_ctx):
Expand Down