@@ -179,13 +179,33 @@ def test_randomize(self):
179179 self .assertTrue (regrtest .randomize )
180180 self .assertIsInstance (regrtest .random_seed , int )
181181
182+ def test_no_randomize (self ):
183+ ns = self .parse_args ([])
184+ self .assertIs (ns .randomize , False )
185+
186+ ns = self .parse_args (["--randomize" ])
187+ self .assertIs (ns .randomize , True )
188+
189+ ns = self .parse_args (["--no-randomize" ])
190+ self .assertIs (ns .randomize , False )
191+
192+ ns = self .parse_args (["--randomize" , "--no-randomize" ])
193+ self .assertIs (ns .randomize , False )
194+
195+ ns = self .parse_args (["--no-randomize" , "--randomize" ])
196+ self .assertIs (ns .randomize , False )
197+
182198 def test_randseed (self ):
183199 ns = self .parse_args (['--randseed' , '12345' ])
184200 self .assertEqual (ns .random_seed , 12345 )
185201 self .assertTrue (ns .randomize )
186202 self .checkError (['--randseed' ], 'expected one argument' )
187203 self .checkError (['--randseed' , 'foo' ], 'invalid int value' )
188204
205+ ns = self .parse_args (['--randseed' , '12345' , '--no-randomize' ])
206+ self .assertEqual (ns .random_seed , 12345 )
207+ self .assertFalse (ns .randomize )
208+
189209 def test_fromfile (self ):
190210 for opt in '-f' , '--fromfile' :
191211 with self .subTest (opt = opt ):
@@ -425,11 +445,12 @@ def create_regrtest(self, args):
425445
426446 return regrtest
427447
428- def check_ci_mode (self , args , use_resources , rerun = True ):
448+ def check_ci_mode (self , args , use_resources , * , rerun = True , randomize = True ):
429449 regrtest = self .create_regrtest (args )
430450 self .assertEqual (regrtest .num_workers , - 1 )
431451 self .assertEqual (regrtest .want_rerun , rerun )
432- self .assertTrue (regrtest .randomize )
452+ self .assertEqual (regrtest .fail_rerun , False )
453+ self .assertEqual (regrtest .randomize , randomize )
433454 self .assertIsInstance (regrtest .random_seed , int )
434455 self .assertTrue (regrtest .fail_env_changed )
435456 self .assertTrue (regrtest .print_slowest )
@@ -466,6 +487,15 @@ def test_slow_ci(self):
466487 regrtest = self .check_ci_mode (args , use_resources )
467488 self .assertEqual (regrtest .timeout , 20 * 60 )
468489
490+ def test_ci_no_randomize (self ):
491+ all_resources = set (cmdline .ALL_RESOURCES )
492+ self .check_ci_mode (
493+ ["--slow-ci" , "--no-randomize" ], all_resources , randomize = False
494+ )
495+ self .check_ci_mode (
496+ ["--fast-ci" , "--no-randomize" ], all_resources - {'cpu' }, randomize = False
497+ )
498+
469499 def test_dont_add_python_opts (self ):
470500 args = ['--dont-add-python-opts' ]
471501 ns = cmdline ._parse_args (args )
0 commit comments