Skip to content

Commit 53de376

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1597 from ekouts/bugfix/detailed_hooks
[bugfix] List inherited pipeline hooks with the `-L` option
2 parents 8b6a23f + 6268f6e commit 53de376

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

reframe/core/pipeline.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ def disable_hook(cls, hook_name):
148148
'''
149149
cls._rfm_disabled_hooks.add(hook_name)
150150

151+
@classmethod
152+
def pipeline_hooks(cls):
153+
ret = {}
154+
for c in cls.mro():
155+
if hasattr(c, '_rfm_pipeline_hooks'):
156+
for kind, hook in c._rfm_pipeline_hooks.items():
157+
ret.setdefault(kind, [])
158+
ret[kind] += hook
159+
160+
return ret
161+
151162
#: The name of the test.
152163
#:
153164
#: :type: string that can contain any character except ``/``

reframe/frontend/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def fmt_deps():
7171
'Node allocation': node_alloc_scheme,
7272
'Pipeline hooks': {
7373
k: fmt_list(fn.__name__ for fn in v)
74-
for k, v in type(check)._rfm_pipeline_hooks.items()
74+
for k, v in check.pipeline_hooks().items()
7575
},
7676
'Tags': fmt_list(check.tags),
7777
'Valid environments': fmt_list(check.valid_prog_environs),

unittests/test_pipeline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,10 @@ class MyTest(DerivedTest):
633633
_run(test, *local_exec_ctx)
634634
assert test.var == 2
635635
assert test.foo == 1
636+
assert test.pipeline_hooks() == {
637+
'post_setup': [DerivedTest.z, BaseTest.x],
638+
'pre_run': [C.y],
639+
}
636640

637641

638642
def test_overriden_hooks(local_exec_ctx):

0 commit comments

Comments
 (0)