Skip to content

Commit 2a76373

Browse files
committed
Work in review
1 parent 7234b84 commit 2a76373

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

easybuild/framework/easyblock.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,14 +1816,16 @@ def remove_module_file(self):
18161816
self.log.info("Removing existing module file %s", self.mod_filepath)
18171817
remove_file(self.mod_filepath)
18181818

1819-
def report_test_failure(self, msgOrError):
1820-
"""Report a failing test either via an exception or warning depending on ignore-test-failure
1819+
def report_test_failure(self, msg_or_error):
1820+
"""
1821+
Report a failing test either via an exception or warning depending on ignore-test-failure
18211822
1822-
msgOrError - Failure description. Either a string or an EasyBuildError"""
1823+
:param msg_or_error: failure description (string value or an EasyBuildError instance)
1824+
"""
18231825
if self.ignore_test_failure:
1824-
print_warning("Test failure ignored: " + str(msgOrError), log=self.log)
1826+
print_warning("Test failure ignored: " + str(msg_or_error), log=self.log)
18251827
else:
1826-
exception = msgOrError if isinstance(msgOrError, EasyBuildError) else EasyBuildError(msgOrError)
1828+
exception = msg_or_error if isinstance(msg_or_error, EasyBuildError) else EasyBuildError(msg_or_error)
18271829
raise exception
18281830

18291831
#
@@ -2245,8 +2247,8 @@ def _test_step(self):
22452247
"""Run the test_step and handles failures"""
22462248
try:
22472249
self.test_step()
2248-
except EasyBuildError as e:
2249-
self.report_test_failure(e)
2250+
except EasyBuildError as err:
2251+
self.report_test_failure(err)
22502252

22512253
def stage_install_step(self):
22522254
"""
@@ -3384,7 +3386,7 @@ def run_step(self, step, step_methods):
33843386
for step_method in step_methods:
33853387
# Remove leading underscore from e.g. "_test_step"
33863388
method_name = extract_method_name(step_method).lstrip('_')
3387-
self.log.info("Running method %s part of step %s" % (method_name, step))
3389+
self.log.info("Running method %s part of step %s", method_name, step)
33883390

33893391
if self.dry_run:
33903392
self.dry_run_msg("[%s method]", method_name)

easybuild/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def main(args=None, logfile=None, do_build=None, testing=False, modtool=None):
307307

308308
if options.skip_test_step:
309309
if options.ignore_test_failure:
310-
raise EasyBuildError("Found both ignore-test-failure and skip-test-step being set. "
310+
raise EasyBuildError("Found both ignore-test-failure and skip-test-step enabled. "
311311
"Please use only one of them.")
312312
else:
313313
print_warning("Will not run the test step as requested via skip-test-step. "

test/framework/options.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def test_ignore_test_failure(self):
398398
"""Test ignore failing tests (--ignore-test-failure)."""
399399

400400
topdir = os.path.abspath(os.path.dirname(__file__))
401+
# This EC uses a `runtest` command which does not exist and hence will make the test step fail
401402
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0-test.eb')
402403

403404
args = [toy_ec, '--ignore-test-failure', '--force']
@@ -407,13 +408,13 @@ def test_ignore_test_failure(self):
407408

408409
msg = 'Test failure ignored'
409410
self.assertTrue(re.search(msg, outtxt),
410-
"Ignored test failure message in log not found, outtxt: %s" % outtxt)
411+
"Ignored test failure message in log should be found, outtxt: %s" % outtxt)
411412
self.assertTrue(re.search(msg, stderr.getvalue()),
412-
"Ignored test failure message in stderr not found, stderr: %s" % stderr.getvalue())
413+
"Ignored test failure message in stderr should be found, stderr: %s" % stderr.getvalue())
413414

414415
# Passing skip and ignore options is disallowed
415416
args.append('--skip-test-step')
416-
error_pattern = 'Found both ignore-test-failure and skip-test-step being set'
417+
error_pattern = 'Found both ignore-test-failure and skip-test-step enabled'
417418
self.assertErrorRegex(EasyBuildError, error_pattern, self.eb_main, args, do_build=True, raise_error=True)
418419

419420
def test_job(self):

0 commit comments

Comments
 (0)