@@ -234,7 +234,6 @@ def test_report_on_with_reruns(self, testdir):
234234 assert self ._substring_in_output ('1 rerun' , result .outlines )
235235 assert self ._substring_in_output ('RERUN test_report_on_with_reruns.py::test_flaky_test' , result .outlines )
236236
237-
238237 def test_report_on_without_reruns (self , testdir ):
239238 test_file = self .variety_of_tests (testdir )
240239
@@ -277,24 +276,69 @@ def test_verbose_statuses_with_reruns(self, testdir):
277276 assert self ._substring_in_output ('1 rerun' , result .outlines )
278277 assert self ._substring_in_output ('test_verbose_statuses_with_reruns.py:21: test_flaky_test RERUN' , result .outlines )
279278
280- def test_report_with_xdist_dash_n (self , testdir ):
281- '''This test is identical to test_flakey_test_report_normal except it
279+ def test_report_off_with_reruns_with_xdist (self , testdir ):
280+ '''This test is identical to test_report_off_with_reruns except it
282281 also uses xdist's -n flag.
283282 '''
284283 # precondition: xdist installed
284+ self ._pytest_xdist_installed (testdir )
285+
286+ test_file = self .variety_of_tests (testdir )
287+
288+ result = testdir .runpytest ('--reruns=2' , '-n 1' )
289+
290+ assert self ._substring_in_output ('.FxXR' , result .outlines )
291+
292+ assert self ._substring_in_output ('1 passed' , result .outlines )
293+
294+ assert self ._substring_in_output ('1 failed' , result .outlines )
295+ assert not self ._substring_in_output ('FAIL test_report_off_with_reruns_with_xdist.py::test_fake_fail' , result .outlines )
296+
297+ assert self ._substring_in_output ('1 xpassed' , result .outlines )
298+ assert not self ._substring_in_output ('XPASS test_report_off_with_reruns_with_xdist.py::test_xpass' , result .outlines )
299+
300+ assert self ._substring_in_output ('1 xfailed' , result .outlines )
301+ assert not self ._substring_in_output ('XFAIL test_report_off_with_reruns_with_xdist.py::test_xfail' , result .outlines )
302+
303+ assert not self ._substring_in_output ('RERUN test_report_off_with_reruns_with_xdist.py::test_flaky_test' , result .outlines )
304+ assert self ._substring_in_output ('1 rerun' , result .outlines )
305+
306+ def test_report_on_with_reruns_with_xdist (self , testdir ):
307+ '''This test is identical to test_report_on_with_reruns except it
308+ also uses xdist's -n flag.
309+ '''
310+ # precondition: xdist installed
311+ self ._pytest_xdist_installed (testdir )
312+
313+ test_file = self .variety_of_tests (testdir )
314+
315+ result = testdir .runpytest ('--reruns=2' , '-r fsxXR' , '-n 1' )
316+
317+ assert self ._substring_in_output ('.FxXR' , result .outlines )
318+
319+ assert self ._substring_in_output (' 1 passed' , result .outlines )
320+
321+ assert self ._substring_in_output ('1 failed' , result .outlines )
322+ assert self ._substring_in_output ('FAIL test_report_on_with_reruns_with_xdist.py::test_fake_fail' , result .outlines )
323+
324+ assert self ._substring_in_output ('1 xpassed' , result .outlines )
325+ assert self ._substring_in_output ('XPASS test_report_on_with_reruns_with_xdist.py::test_xpass' , result .outlines )
326+
327+ assert self ._substring_in_output ('1 xfailed' , result .outlines )
328+ assert self ._substring_in_output ('XFAIL test_report_on_with_reruns_with_xdist.py::test_xfail' , result .outlines )
329+
330+ assert self ._substring_in_output ('1 rerun' , result .outlines )
331+ assert self ._substring_in_output ('RERUN test_report_on_with_reruns_with_xdist.py::test_flaky_test' , result .outlines )
332+
333+
334+ def _pytest_xdist_installed (self , testdir ):
285335 try :
286336 result = testdir .runpytest ('--version' )
287337 result .stderr .fnmatch_lines (['*pytest-xdist*' ])
288338 except Exception :
289339 import pytest
290340 pytest .skip ("this test requires pytest-xdist" )
291341
292- test_file = testdir .makepyfile (self .flakey_test )
293-
294- result = testdir .runpytest ('--reruns=2' , '-n 1' , '-r fsxXR' )
295- assert self ._substring_in_output ('RERUN test_report_with_xdist_dash_n.py::test_flaky_test' , result .outlines )
296- assert self ._substring_in_output ('1 rerun' , result .outlines )
297-
298342 def _substring_in_output (self , substring , output_lines ):
299343 print '-' * 30
300344 found = False
0 commit comments