Skip to content

Commit

Permalink
Merge pull request #481 from Pyifan/bugfix
Browse files Browse the repository at this point in the history
PyTest to support pytest.skip
  • Loading branch information
yuxuan-ms authored Aug 21, 2020
2 parents 325a004 + 6b6b6bb commit 77062d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions testplan/testing/py_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
)
Expand Down

0 comments on commit 77062d2

Please sign in to comment.