@@ -409,27 +409,31 @@ def pytest_runtest_logfinish(nodeid, location):
409409 result .stdout .fnmatch_lines (hook_message )
410410
411411@pytest .mark .parametrize (
412- "file_text, only_rerun_text , should_rerun" ,
412+ "file_text, only_rerun_texts , should_rerun" ,
413413 [
414- ('def test_only_rerun(): raise AssertionError("ERR")' , 'AssertionError' , True ),
415- ('def test_only_rerun(): raise AssertionError("ERR")' , 'Assertion*' , True ),
416- ('def test_only_rerun(): raise AssertionError("ERR")' , 'Assertion' , True ),
417- ('def test_only_rerun(): raise AssertionError("ERR")' , 'ValueError' , False ),
418- ('def test_only_rerun(): raise AssertionError("ERR")' , 'AssertionError,ValueError' , True ),
419- ('def test_only_rerun(): raise AssertionError("ERR")' , 'AssertionError ValueError' , False ),
420- ('def test_only_rerun(): raise AssertionError("ERR")' , '' , True ),
421- ('def test_only_rerun(): raise AssertionError("ERR")' , 'AssertionError: ' , True ),
422- ('def test_only_rerun(): raise AssertionError("ERR")' , 'AssertionError: ERR' , True ),
423- ('def test_only_rerun(): raise AssertionError("ERR")' , 'ERR' , True ),
414+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError' ], True ),
415+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['Assertion*' ], True ),
416+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['Assertion' ], True ),
417+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['ValueError' ], False ),
418+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['' ], True ),
419+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError: ' ], True ),
420+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError: ERR' ], True ),
421+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['ERR' ], True ),
422+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError,ValueError' ], False ),
423+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError ValueError' ], False ),
424+ ('def test_only_rerun(): raise AssertionError("ERR")' , ['AssertionError' ,'ValueError' ], True ),
424425 ]
425426)
426- def test_only_rerun_flag (testdir , file_text , only_rerun_text , should_rerun ):
427+ def test_only_rerun_flag (testdir , file_text , only_rerun_texts , should_rerun ):
427428 testdir .makepyfile (file_text )
428429
429430 num_failed = 1
430431 num_passed = 0
431432 num_reruns = 1
432433 num_reruns_actual = num_reruns if should_rerun else 0
433434
434- result = testdir .runpytest ('--reruns' , str (num_reruns ), '--only-rerun' , only_rerun_text )
435+ pytest_args = ['--reruns' , str (num_reruns )]
436+ for only_rerun_text in only_rerun_texts :
437+ pytest_args .extend (['--only-rerun' , only_rerun_text ])
438+ result = testdir .runpytest (* pytest_args )
435439 assert_outcomes (result , passed = num_passed , failed = num_failed , rerun = num_reruns_actual )
0 commit comments