Add acceptance test for plugins which log tests multiple times
Fix #206
This commit is contained in:
2
changelog/206.feature
Normal file
2
changelog/206.feature
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
``xdist`` now supports tests to log results multiple times, improving integration with plugins which require
|
||||||
|
it like `pytest-rerunfailures <https://github.com/gocept/pytest-rerunfailures>_`.
|
||||||
@@ -502,6 +502,32 @@ def test_crashing_item(testdir, when):
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_multiple_log_reports(testdir):
|
||||||
|
"""
|
||||||
|
Ensure that pytest-xdist supports plugins that emit multiple logreports
|
||||||
|
(#206).
|
||||||
|
Inspired by pytest-rerunfailures.
|
||||||
|
"""
|
||||||
|
testdir.makeconftest("""
|
||||||
|
from _pytest.runner import runtestprotocol
|
||||||
|
def pytest_runtest_protocol(item, nextitem):
|
||||||
|
item.ihook.pytest_runtest_logstart(nodeid=item.nodeid,
|
||||||
|
location=item.location)
|
||||||
|
reports = runtestprotocol(item, nextitem=nextitem)
|
||||||
|
for report in reports:
|
||||||
|
item.ihook.pytest_runtest_logreport(report=report)
|
||||||
|
return True
|
||||||
|
""")
|
||||||
|
testdir.makepyfile("""
|
||||||
|
def test():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest("-n1")
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*2 passed*",
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_skipping(testdir):
|
def test_skipping(testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
Reference in New Issue
Block a user