@@ -182,13 +182,33 @@ def test_randomize(self):
182
182
self .assertTrue (regrtest .randomize )
183
183
self .assertIsInstance (regrtest .random_seed , int )
184
184
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
+
185
201
def test_randseed (self ):
186
202
ns = self .parse_args (['--randseed' , '12345' ])
187
203
self .assertEqual (ns .random_seed , 12345 )
188
204
self .assertTrue (ns .randomize )
189
205
self .checkError (['--randseed' ], 'expected one argument' )
190
206
self .checkError (['--randseed' , 'foo' ], 'invalid int value' )
191
207
208
+ ns = self .parse_args (['--randseed' , '12345' , '--no-randomize' ])
209
+ self .assertEqual (ns .random_seed , 12345 )
210
+ self .assertFalse (ns .randomize )
211
+
192
212
def test_fromfile (self ):
193
213
for opt in '-f' , '--fromfile' :
194
214
with self .subTest (opt = opt ):
@@ -428,11 +448,12 @@ def create_regrtest(self, args):
428
448
429
449
return regrtest
430
450
431
- def check_ci_mode (self , args , use_resources , rerun = True ):
451
+ def check_ci_mode (self , args , use_resources , * , rerun = True , randomize = True ):
432
452
regrtest = self .create_regrtest (args )
433
453
self .assertEqual (regrtest .num_workers , - 1 )
434
454
self .assertEqual (regrtest .want_rerun , rerun )
435
- self .assertTrue (regrtest .randomize )
455
+ self .assertEqual (regrtest .fail_rerun , False )
456
+ self .assertEqual (regrtest .randomize , randomize )
436
457
self .assertIsInstance (regrtest .random_seed , int )
437
458
self .assertTrue (regrtest .fail_env_changed )
438
459
self .assertTrue (regrtest .print_slowest )
@@ -469,6 +490,15 @@ def test_slow_ci(self):
469
490
regrtest = self .check_ci_mode (args , use_resources )
470
491
self .assertEqual (regrtest .timeout , 20 * 60 )
471
492
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
+
472
502
def test_dont_add_python_opts (self ):
473
503
args = ['--dont-add-python-opts' ]
474
504
ns = cmdline ._parse_args (args )
0 commit comments