mirror of
https://github.com/python/cpython.git
synced 2025-11-02 14:41:33 +00:00
gh-137242: Add a --no-randomize option, and use it in Android CI (#138649)
Adds a --no-randomize option to the CI runner, so that randomisation can be easily disabled for --fast-ci and --slow-ci configurations on single-threaded testing platforms like Android, iOS, and Emscripten. --------- Co-authored-by: Malcolm Smith <smith@chaquo.com>
This commit is contained in:
parent
22cb9ba8f9
commit
01895d233b
3 changed files with 40 additions and 7 deletions
|
|
@ -182,6 +182,22 @@ def test_randomize(self):
|
|||
self.assertTrue(regrtest.randomize)
|
||||
self.assertIsInstance(regrtest.random_seed, int)
|
||||
|
||||
def test_no_randomize(self):
|
||||
ns = self.parse_args([])
|
||||
self.assertIs(ns.randomize, False)
|
||||
|
||||
ns = self.parse_args(["--randomize"])
|
||||
self.assertIs(ns.randomize, True)
|
||||
|
||||
ns = self.parse_args(["--no-randomize"])
|
||||
self.assertIs(ns.randomize, False)
|
||||
|
||||
ns = self.parse_args(["--randomize", "--no-randomize"])
|
||||
self.assertIs(ns.randomize, False)
|
||||
|
||||
ns = self.parse_args(["--no-randomize", "--randomize"])
|
||||
self.assertIs(ns.randomize, False)
|
||||
|
||||
def test_randseed(self):
|
||||
ns = self.parse_args(['--randseed', '12345'])
|
||||
self.assertEqual(ns.random_seed, 12345)
|
||||
|
|
@ -189,6 +205,10 @@ def test_randseed(self):
|
|||
self.checkError(['--randseed'], 'expected one argument')
|
||||
self.checkError(['--randseed', 'foo'], 'invalid int value')
|
||||
|
||||
ns = self.parse_args(['--randseed', '12345', '--no-randomize'])
|
||||
self.assertEqual(ns.random_seed, 12345)
|
||||
self.assertFalse(ns.randomize)
|
||||
|
||||
def test_fromfile(self):
|
||||
for opt in '-f', '--fromfile':
|
||||
with self.subTest(opt=opt):
|
||||
|
|
@ -428,11 +448,12 @@ def create_regrtest(self, args):
|
|||
|
||||
return regrtest
|
||||
|
||||
def check_ci_mode(self, args, use_resources, rerun=True):
|
||||
def check_ci_mode(self, args, use_resources, *, rerun=True, randomize=True):
|
||||
regrtest = self.create_regrtest(args)
|
||||
self.assertEqual(regrtest.num_workers, -1)
|
||||
self.assertEqual(regrtest.want_rerun, rerun)
|
||||
self.assertTrue(regrtest.randomize)
|
||||
self.assertEqual(regrtest.fail_rerun, False)
|
||||
self.assertEqual(regrtest.randomize, randomize)
|
||||
self.assertIsInstance(regrtest.random_seed, int)
|
||||
self.assertTrue(regrtest.fail_env_changed)
|
||||
self.assertTrue(regrtest.print_slowest)
|
||||
|
|
@ -469,6 +490,15 @@ def test_slow_ci(self):
|
|||
regrtest = self.check_ci_mode(args, use_resources)
|
||||
self.assertEqual(regrtest.timeout, 20 * 60)
|
||||
|
||||
def test_ci_no_randomize(self):
|
||||
all_resources = set(cmdline.ALL_RESOURCES)
|
||||
self.check_ci_mode(
|
||||
["--slow-ci", "--no-randomize"], all_resources, randomize=False
|
||||
)
|
||||
self.check_ci_mode(
|
||||
["--fast-ci", "--no-randomize"], all_resources - {'cpu'}, randomize=False
|
||||
)
|
||||
|
||||
def test_dont_add_python_opts(self):
|
||||
args = ['--dont-add-python-opts']
|
||||
ns = cmdline._parse_args(args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue