Skip to content

Commit 9f0f935

Browse files
committed
Make test more strict
1 parent 4269422 commit 9f0f935

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

easybuild/base/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ def __init__(self, msg, *args, **kwargs):
136136
logger = self.LOGGER_MODULE.getLogger()
137137

138138
if backtrace:
139-
msg += '\nCallstack: \n\t' + '\n\t'.join(backtrace)
139+
msg += '\nCallstack:\n\t' + '\n\t'.join(backtrace)
140140
getattr(logger, self.LOGGING_METHOD_NAME)(msg)

test/framework/build_log.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ def test_easybuilderror(self):
8686
self.assertErrorRegex(EasyBuildError, 'Failed to read', tweak_one, '/does/not/exist', '/tmp/new', {})
8787
logtxt: str = read_file(logfile)
8888

89-
self.assertIn('EasyBuild encountered an error: Failed to read /does/not/exist:', logtxt)
90-
self.assertIn('Callstack:', logtxt)
91-
callstack = logtxt.split('Callstack:', maxsplit=1)[-1]
92-
self.assert_multi_regex([
93-
r'easybuild/tools/filetools\.py:\d+ in read_file',
94-
r'easybuild/framework/easyconfig/tweak\.py:\d+ in tweak_one',
95-
r'easybuild/base/testing\.py:\d+ in assertErrorRegex',
96-
], callstack)
89+
self.assertRegex(logtxt, '\n'.join(
90+
(r"EasyBuild encountered an error: Failed to read /does/not/exist:.*",
91+
r"Callstack:",
92+
r'\s+easybuild/tools/filetools\.py:\d+ in read_file',
93+
r'\s+easybuild/framework/easyconfig/tweak\.py:\d+ in tweak_one',
94+
r'\s+easybuild/base/testing\.py:\d+ in assertErrorRegex',
95+
)), re.M)
9796

9897
def test_easybuildlog(self):
9998
"""Tests for EasyBuildLog."""

0 commit comments

Comments
 (0)