MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_random_report_log_xdist

Function test_random_report_log_xdist

testing/test_junitxml.py:1338–1361  ·  view source on GitHub ↗

`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
)

Source from the content-addressed store, hash-verified

1336
1337
1338def 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

Callers

nothing calls this directly

Calls 6

run_and_parseFunction · 0.85
delenvMethod · 0.80
find_first_by_tagMethod · 0.80
find_by_tagMethod · 0.80
appendMethod · 0.80
makepyfileMethod · 0.45

Tested by

no test coverage detected