Commit 7f123f1f authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: properly fail when !OUTPUT_FILE: is not found

closes #64
parent b5f680ad
Pipeline #2727 passed with stages
in 18 seconds
......@@ -985,8 +985,23 @@ class TestSuite():
test_lines, exit_test = self.launch([current_cmd], verbose, colorize)
self.one_test(exit_test, test_lines, verbose, colorize)
self.cmds.append(current_cmd)
current_test_lines += test_lines
self.test_lines += test_lines
if not self.source:
# Regular testing, stdout added to 'current_test_lines'
current_test_lines += test_lines
self.test_lines += test_lines
else:
# !OUTPUT_FILE:, the content of the file overrides 'current_test_lines'
try:
with open(self.source) as f:
current_test_lines = f.readlines()
except OSError:
msg = self.source + ' not found'
self.skip_set(msg)
exit_test.status = Sta(S_FAILED)
exit_test.info += ' - ' + msg
current_test_lines = []
current_cmd = ''
......@@ -1041,7 +1056,7 @@ class TestSuite():
if verbose > 0:
self.print_stderr(colorize)
return open(self.source).readlines() if self.source else self.stdout, exit_test
return self.stdout, exit_test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment