@@ -182,13 +182,33 @@ def test_randomize(self):
182182 self .assertTrue (regrtest .randomize )
183183 self .assertIsInstance (regrtest .random_seed , int )
184184
185+ def test_no_randomize (self ):
186+ ns = self .parse_args ([])
187+ self .assertIs (ns .randomize , False )
188+
189+ ns = self .parse_args (["--randomize" ])
190+ self .assertIs (ns .randomize , True )
191+
192+ ns = self .parse_args (["--no-randomize" ])
193+ self .assertIs (ns .randomize , False )
194+
195+ ns = self .parse_args (["--randomize" , "--no-randomize" ])
196+ self .assertIs (ns .randomize , False )
197+
198+ ns = self .parse_args (["--no-randomize" , "--randomize" ])
199+ self .assertIs (ns .randomize , False )
200+
185201 def test_randseed (self ):
186202 ns = self .parse_args (['--randseed' , '12345' ])
187203 self .assertEqual (ns .random_seed , 12345 )
188204 self .assertTrue (ns .randomize )
189205 self .checkError (['--randseed' ], 'expected one argument' )
190206 self .checkError (['--randseed' , 'foo' ], 'invalid int value' )
191207
208+ ns = self .parse_args (['--randseed' , '12345' , '--no-randomize' ])
209+ self .assertEqual (ns .random_seed , 12345 )
210+ self .assertFalse (ns .randomize )
211+
192212 def test_fromfile (self ):
193213 for opt in '-f' , '--fromfile' :
194214 with self .subTest (opt = opt ):
@@ -428,11 +448,12 @@ def create_regrtest(self, args):
428448
429449 return regrtest
430450
431- def check_ci_mode (self , args , use_resources , rerun = True ):
451+ def check_ci_mode (self , args , use_resources , * , rerun = True , randomize = True ):
432452 regrtest = self .create_regrtest (args )
433453 self .assertEqual (regrtest .num_workers , - 1 )
434454 self .assertEqual (regrtest .want_rerun , rerun )
435- self .assertTrue (regrtest .randomize )
455+ self .assertEqual (regrtest .fail_rerun , False )
456+ self .assertEqual (regrtest .randomize , randomize )
436457 self .assertIsInstance (regrtest .random_seed , int )
437458 self .assertTrue (regrtest .fail_env_changed )
438459 self .assertTrue (regrtest .print_slowest )
@@ -469,6 +490,15 @@ def test_slow_ci(self):
469490 regrtest = self .check_ci_mode (args , use_resources )
470491 self .assertEqual (regrtest .timeout , 20 * 60 )
471492
493+ def test_ci_no_randomize (self ):
494+ all_resources = set (cmdline .ALL_RESOURCES )
495+ self .check_ci_mode (
496+ ["--slow-ci" , "--no-randomize" ], all_resources , randomize = False
497+ )
498+ self .check_ci_mode (
499+ ["--fast-ci" , "--no-randomize" ], all_resources - {'cpu' }, randomize = False
500+ )
501+
472502 def test_dont_add_python_opts (self ):
473503 args = ['--dont-add-python-opts' ]
474504 ns = cmdline ._parse_args (args )
0 commit comments