diff --git a/easybuild/tools/hooks.py b/easybuild/tools/hooks.py index cb2d72c472..6046e933f1 100644 --- a/easybuild/tools/hooks.py +++ b/easybuild/tools/hooks.py @@ -33,6 +33,7 @@ from easybuild.base import fancylogger from easybuild.tools.build_log import EasyBuildError, print_msg +from easybuild.tools.config import build_option _log = fancylogger.getLogger('hooks', fname=False) @@ -191,7 +192,8 @@ def run_hook(label, hooks, pre_step_hook=False, post_step_hook=False, args=None, if msg is None: msg = "Running %s hook..." % label - print_msg(msg) + if build_option('debug'): + print_msg(msg) _log.info("Running '%s' hook function (arguments: %s)...", hook.__name__, args) res = hook(*args) diff --git a/test/framework/hooks.py b/test/framework/hooks.py index f51cd0fc91..1e3c44ea5f 100644 --- a/test/framework/hooks.py +++ b/test/framework/hooks.py @@ -29,7 +29,7 @@ """ import os import sys -from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered +from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config from unittest import TextTestRunner import easybuild.tools.hooks @@ -124,6 +124,8 @@ def test_run_hook(self): hooks = load_hooks(self.test_hooks_pymod) + init_config(build_options={'debug': True}) + self.mock_stdout(True) self.mock_stderr(True) run_hook('start', hooks)