Commit 90feaa09 authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: properly handle exit tests in TestSuite.launch() and .test()

see #36
parent 74fb1b87
......@@ -798,7 +798,8 @@ class TestSuite():
# Test current_cmds with current_tests
if not self.skip:
test_lines = self.launch(current_cmds, verbose, colorize)
test_lines, exit_test = self.launch(current_cmds, verbose, colorize)
current_tests.append(exit_test)
self.test_lines += test_lines
self.tests_on_lines(current_tests, test_lines, verbose, colorize)
self.debug(self.status, "\n".join(current_cmds), test_lines, verbose, colorize)
......@@ -847,12 +848,15 @@ class TestSuite():
try:
self.exit_code = p.wait(self.timeout)
self.tests.append(ExternalTestCase('Exit code is %d' % self.expected_exit_code, self.exit_code == self.expected_exit_code, str(self.exit_code)))
exit_test = ExternalTestCase('Exit code is %d' % self.expected_exit_code, self.exit_code == self.expected_exit_code, str(self.exit_code))
except subprocess.TimeoutExpired:
self.exit_code = None
self.tests.append(ExternalTestCase('Exit code is %d' % self.expected_exit_code, SKIP, 'timeout after %s seconds' % self.timeout))
exit_test = ExternalTestCase('Exit code is %d' % self.expected_exit_code, SKIP, 'timeout after %s seconds' % self.timeout)
p.kill()
self.tests.append(exit_test)
self.status = combine_status(self.status, exit_test.status)
if self.elapsed_time is None:
self.elapsed_time = 0
self.elapsed_time += time.time() - start_time
......@@ -867,7 +871,7 @@ class TestSuite():
if verbose > 0:
self.print_stderr(colorize)
return open(self.source).readlines() if self.source else self.stdout
return open(self.source).readlines() if self.source else 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