def test_random_report_log_xdist(testdir):
 pytest.importorskip('xdist')
 testdir.makepyfile("\n        import pytest, time\n        @pytest.mark.parametrize('i', list(range(30)))\n        def test_x(i):\n            assert i != 22\n    ")
 (_, dom) = runandparse(testdir, '-n2')
 suite_node = dom.find_first_by_tag('testsuite')
 failed = []
 for case_node in suite_node.find_by_tag('testcase'):
  if case_node.find_first_by_tag('failure'):
   failed.append(case_node['name'])
 assert (failed == ['test_x[22]'])

def test_random_report_log_xdist ( testdir ) : pytest . importorskip ( 'xdist' ) testdir . makepyfile ( "\n        import pytest, time\n        @pytest.mark.parametrize('i', list(range(30)))\n        def test_x(i):\n            assert i != 22\n    " ) ( _ , dom ) = runandparse ( testdir , '-n2' ) suite_node = dom . find_first_by_tag ( 'testsuite' ) failed = [ ] for case_node in suite_node . find_by_tag ( 'testcase' ) : if case_node . find_first_by_tag ( 'failure' ) : failed . append ( case_node [ 'name' ] ) assert ( failed == [ 'test_x[22]' ] )
xdist calls pytest_runtest_logreport as they are executed by the slaves .