Skip to content

Commit 8eee0f4

Browse files
committed
Add some notes and tips in the docs of pipeline hooks
1 parent ca27278 commit 8eee0f4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/regression_test_api.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ the run hooks of :class:`Y` will be executed as follows:
158158
.. seealso::
159159
- :func:`@run_before <reframe.core.builtins.run_before>`, :func:`@run_after <reframe.core.builtins.run_after>` decorators
160160

161+
.. note::
162+
163+
Pipeline hook functions cannot be private, i.e., starting with double underscore: ``__``.
164+
161165
.. note::
162166
Pipeline hooks do not execute in the test's stage directory, but in the directory that ReFrame executes in.
163167
However, the test's :attr:`~reframe.core.pipeline.RegressionTest.stagedir` can be accessed by explicitly changing the working directory from within the hook function itself (see the :class:`~reframe.utility.osext.change_dir` utility for further details):
@@ -197,6 +201,11 @@ the run hooks of :class:`Y` will be executed as follows:
197201
This version defines the execution order of hooks, which now follows a strict reverse MRO order, so that parent hooks will execute before those of derived classes.
198202
Tests that relied on the execution order of hooks might break with this change.
199203

204+
.. tip::
205+
206+
When writing library tests or :class:`~reframe.core.pipeline.RegressionMixin`'s that are meant to be re-used by multiple final tests, it is a good practice to define their hooks using a unique name scheme, e.g., ``_<ClassName>_<hook_name>``.
207+
This will avoid possible clashes with hooks in derived test classes that may use the same hook name hiding inadvertently the base class hook.
208+
Note that in future ReFrame may create unique names for pipeline hooks automatically.
200209

201210

202211
.. _test-variants:

0 commit comments

Comments
 (0)