`xdist` calls pytest_runtest_logreport as they are executed by the workers, with nodes from several nodes overlapping, so junitxml must cope with that to produce correct reports (#1064).
(
pytester: Pytester, monkeypatch: MonkeyPatch, run_and_parse: RunAndParse
)
| 1336 | |
| 1337 | |
| 1338 | def test_random_report_log_xdist( |
| 1339 | pytester: Pytester, monkeypatch: MonkeyPatch, run_and_parse: RunAndParse |
| 1340 | ) -> None: |
| 1341 | """`xdist` calls pytest_runtest_logreport as they are executed by the workers, |
| 1342 | with nodes from several nodes overlapping, so junitxml must cope with that |
| 1343 | to produce correct reports (#1064).""" |
| 1344 | pytest.importorskip("xdist") |
| 1345 | monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False) |
| 1346 | pytester.makepyfile( |
| 1347 | """ |
| 1348 | import pytest, time |
| 1349 | @pytest.mark.parametrize('i', list(range(30))) |
| 1350 | def test_x(i): |
| 1351 | assert i != 22 |
| 1352 | """ |
| 1353 | ) |
| 1354 | _, dom = run_and_parse("-n2") |
| 1355 | suite_node = dom.find_first_by_tag("testsuite") |
| 1356 | failed = [] |
| 1357 | for case_node in suite_node.find_by_tag("testcase"): |
| 1358 | if case_node.find_first_by_tag("failure"): |
| 1359 | failed.append(case_node["name"]) |
| 1360 | |
| 1361 | assert failed == ["test_x[22]"] |
| 1362 | |
| 1363 | |
| 1364 | @parametrize_families |
nothing calls this directly
no test coverage detected