Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/pytest_run_parallel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ def pytest_report_collectionfinish(self, config, start_path, items):
@pytest.hookimpl(tryfirst=True, wrapper=True)
def pytest_report_teststatus(self, report, config):
outcome = yield
if getattr(report, "when", None) != "call":
if getattr(report, "when", None) != "call" or getattr(
report, "keywords", {}
).get("xfail", None):
return outcome

if report.nodeid in self.run_in_parallel:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_run_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,3 +987,15 @@ def test_forever_without_selected_tests(pytester):
"*Test collection found zero tests when passing --forever. Are you sure you searched for the correct tests?*"
]
)


def test_xpass_not_treated_as_pass(pytester):
pytester.makepyfile("""
import pytest

@pytest.mark.xfail
def test_xpass():
assert True
""")
result = pytester.runpytest("--parallel-threads=10", "-v")
result.stdout.fnmatch_lines(["*xpassed in*"])
Loading