diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 15390679dc..9b9ab59425 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -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 ``/`` diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index e58aa11359..3136eff5dd 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -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), diff --git a/unittests/test_pipeline.py b/unittests/test_pipeline.py index 601b5789bc..1e330a072f 100644 --- a/unittests/test_pipeline.py +++ b/unittests/test_pipeline.py @@ -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):