Skip to content

Commit

Permalink
gh-109566: regrtest doesn't enable --rerun if --python is used (#109969)
Browse files Browse the repository at this point in the history
regrtest: --fast-ci and --slow-ci options no longer enable --rerun if
the --python option is used.
  • Loading branch information
vstinner committed Sep 27, 2023
1 parent d9809e8 commit 62881a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Lib/test/libregrtest/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ def _parse_args(args, **kwargs):
ns.randomize = True
ns.fail_env_changed = True
ns.fail_rerun = True
ns.rerun = True
if ns.python is None:
ns.rerun = True
ns.print_slow = True
ns.verbose3 = True
if MS_WINDOWS:
Expand Down
12 changes: 10 additions & 2 deletions Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def test_unknown_option(self):
self.checkError(['--unknown-option'],
'unrecognized arguments: --unknown-option')

def check_ci_mode(self, args, use_resources):
def check_ci_mode(self, args, use_resources, rerun=True):
ns = cmdline._parse_args(args)
if utils.MS_WINDOWS:
self.assertTrue(ns.nowindows)
Expand All @@ -383,7 +383,7 @@ def check_ci_mode(self, args, use_resources):
# which has an unclear API
regrtest = main.Regrtest(ns)
self.assertEqual(regrtest.num_workers, -1)
self.assertTrue(regrtest.want_rerun)
self.assertEqual(regrtest.want_rerun, rerun)
self.assertTrue(regrtest.randomize)
self.assertIsNone(regrtest.random_seed)
self.assertTrue(regrtest.fail_env_changed)
Expand All @@ -400,6 +400,14 @@ def test_fast_ci(self):
regrtest = self.check_ci_mode(args, use_resources)
self.assertEqual(regrtest.timeout, 10 * 60)

def test_fast_ci_python_cmd(self):
args = ['--fast-ci', '--python', 'python -X dev']
use_resources = sorted(cmdline.ALL_RESOURCES)
use_resources.remove('cpu')
regrtest = self.check_ci_mode(args, use_resources, rerun=False)
self.assertEqual(regrtest.timeout, 10 * 60)
self.assertEqual(regrtest.python_cmd, ('python', '-X', 'dev'))

def test_fast_ci_resource(self):
# it should be possible to override resources
args = ['--fast-ci', '-u', 'network']
Expand Down

0 comments on commit 62881a7

Please sign in to comment.