mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-109276: regrtest re-runs "env changed" tests (#109831)
When a test fails with "env changed" and --rerun option is used, the test is now re-run in verbose mode in a fresh process.
This commit is contained in:
parent
64ab9f7d5c
commit
72fb39c965
3 changed files with 21 additions and 7 deletions
|
@ -463,7 +463,7 @@ class BaseTestCase(unittest.TestCase):
|
|||
randomize = True
|
||||
|
||||
rerun_failed = []
|
||||
if rerun is not None:
|
||||
if rerun is not None and not env_changed:
|
||||
failed = [rerun.name]
|
||||
if not rerun.success:
|
||||
rerun_failed.append(rerun.name)
|
||||
|
@ -591,7 +591,7 @@ class BaseTestCase(unittest.TestCase):
|
|||
state = ', '.join(state)
|
||||
if rerun is not None:
|
||||
new_state = 'SUCCESS' if rerun.success else 'FAILURE'
|
||||
state = 'FAILURE then ' + new_state
|
||||
state = f'{state} then {new_state}'
|
||||
self.check_line(output, f'Result: {state}', full=True)
|
||||
|
||||
def parse_random_seed(self, output):
|
||||
|
@ -1229,6 +1229,15 @@ class ArgsTestCase(BaseTestCase):
|
|||
self.check_executed_tests(output, [testname], env_changed=testname,
|
||||
fail_env_changed=True, stats=1)
|
||||
|
||||
# rerun
|
||||
output = self.run_tests("--rerun", testname)
|
||||
self.check_executed_tests(output, [testname],
|
||||
env_changed=testname,
|
||||
rerun=Rerun(testname,
|
||||
match=None,
|
||||
success=True),
|
||||
stats=2)
|
||||
|
||||
def test_rerun_fail(self):
|
||||
# FAILURE then FAILURE
|
||||
code = textwrap.dedent("""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue