Skip to content

Commit

Permalink
fix xfail handling (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jupe authored Jun 10, 2020
1 parent f1561ca commit 1f7fdc1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ def test_skip_marker():

def test_skip():
pytest.skip("unsupported configuration")


@pytest.mark.xfail(reason='expected to fail')
def test_xfail():
raise AssertionError('oh no')
9 changes: 6 additions & 3 deletions pytest_opentmi/OpenTmiReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def _append_failed(self, report):
def _append_skipped(self, report):
result = self._new_result(report)
result.execution.verdict = 'skip'
result.execution.note = report.longrepr[2]
if hasattr(report, "wasxfail"):
self.xfailed += 1
result.execution.note = 'xskil'
result.execution.note = f'wasxfail: {report.longrepr.reprcrash.message}'
else:
result.execution.note = report.longrepr[2]
self.skipped += 1
self.results.append(result)

Expand Down Expand Up @@ -133,7 +133,10 @@ def _parse_test(self, report):
break
if report.skipped:
test.execution.skip.value = True
test.execution.skip.reason = report.longrepr[2]
if hasattr(report, 'wasxfail'):
test.execution.skip.reason = report.wasxfail
else:
test.execution.skip.reason = report.longrepr[2]
return test

# pylint: disable=too-many-statements
Expand Down

0 comments on commit 1f7fdc1

Please sign in to comment.