=== modified file 'lava_test/api/delegates.py'
@@ -80,6 +80,7 @@
performed by the test runner.
:type observer: :class:`~lava_test.api.observers.ITestRunnerObserver`
+ :return true if any test step return none-zero return code
.. versionadded:: 0.2
"""
=== modified file 'lava_test/core/runners.py'
@@ -44,14 +44,17 @@
stderr = open(artifacts.stderr_pathname, 'at')
delegate = DisplayDelegate(stdout, stderr, observer)
extcmd = ExternalCommandWithDelegate(delegate)
+ run_failed = False
try:
for cmd in self.steps:
if observer: observer.about_to_run_shell_command(cmd)
returncode = extcmd.call(cmd, shell=True)
if observer: observer.did_run_shell_command(cmd, returncode)
+ if (returncode != 00): run_failed = True
finally:
stdout.close()
stderr.close()
+ return run_failed
def run(self, artifacts, observer=None):
"""
@@ -62,5 +65,6 @@
:meth:`~lava_test.api.delegates.TestRunner.run`
"""
self.starttime = datetime.datetime.utcnow()
- self._run_lava_test_steps(artifacts, observer)
+ run_failed = self._run_lava_test_steps(artifacts, observer)
self.endtime = datetime.datetime.utcnow()
+ return run_failed
=== modified file 'lava_test/core/tests.py'
@@ -126,7 +126,10 @@
logging.debug(
"Invoking %r.run_and_store_artifacts(...)",
self.runner, observer)
- self.runner.run(artifacts, observer)
+ run_fail = self.runner.run(artifacts, observer)
+ if run_fail:
+ raise RuntimeError('Some of test steps returned non-zero exit code')
+
return artifacts
def parse(self, artifacts):
=== modified file 'lava_test/main.py'
@@ -48,4 +48,5 @@
import sys
arg_only = sys.argv
arg_only.remove(arg_only[0])
- LAVATestDispatcher().dispatch(arg_only)
\ No newline at end of file
+ code = LAVATestDispatcher().dispatch(arg_only)
+ if (code != 0): exit(code)
\ No newline at end of file