From 6b6b6bb4aeb5278f0d9eae81c7243c67aee6371f Mon Sep 17 00:00:00 2001 From: Pyifan Date: Thu, 20 Aug 2020 18:20:42 +0800 Subject: [PATCH] PyTest to support pytest.skip --- testplan/testing/py_test.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testplan/testing/py_test.py b/testplan/testing/py_test.py index 367489a69..d3491597a 100644 --- a/testplan/testing/py_test.py +++ b/testplan/testing/py_test.py @@ -115,7 +115,10 @@ def run_tests(self): return_code = pytest.main( self._pytest_args, plugins=[self._pytest_plugin] ) - if return_code != 0: + if return_code == 5: + self.result.report.status_override = Status.UNSTABLE + self.logger.warning("No tests were run") + elif return_code != 0: self.result.report.status_override = Status.FAILED self.logger.error("pytest exited with return code %d", return_code) @@ -126,7 +129,7 @@ def _collect_tests(self): plugins=[self._collect_plugin], ) - if return_code != 0: + if return_code not in (0, 5): # rc 5: no tests were run raise RuntimeError( "Collection failure, exit code = {}".format(return_code) )