@@ -179,13 +179,33 @@ def test_randomize(self):
179
179
self .assertTrue (regrtest .randomize )
180
180
self .assertIsInstance (regrtest .random_seed , int )
181
181
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
+
182
198
def test_randseed (self ):
183
199
ns = self .parse_args (['--randseed' , '12345' ])
184
200
self .assertEqual (ns .random_seed , 12345 )
185
201
self .assertTrue (ns .randomize )
186
202
self .checkError (['--randseed' ], 'expected one argument' )
187
203
self .checkError (['--randseed' , 'foo' ], 'invalid int value' )
188
204
205
+ ns = self .parse_args (['--randseed' , '12345' , '--no-randomize' ])
206
+ self .assertEqual (ns .random_seed , 12345 )
207
+ self .assertFalse (ns .randomize )
208
+
189
209
def test_fromfile (self ):
190
210
for opt in '-f' , '--fromfile' :
191
211
with self .subTest (opt = opt ):
@@ -425,11 +445,12 @@ def create_regrtest(self, args):
425
445
426
446
return regrtest
427
447
428
- def check_ci_mode (self , args , use_resources , rerun = True ):
448
+ def check_ci_mode (self , args , use_resources , * , rerun = True , randomize = True ):
429
449
regrtest = self .create_regrtest (args )
430
450
self .assertEqual (regrtest .num_workers , - 1 )
431
451
self .assertEqual (regrtest .want_rerun , rerun )
432
- self .assertTrue (regrtest .randomize )
452
+ self .assertEqual (regrtest .fail_rerun , False )
453
+ self .assertEqual (regrtest .randomize , randomize )
433
454
self .assertIsInstance (regrtest .random_seed , int )
434
455
self .assertTrue (regrtest .fail_env_changed )
435
456
self .assertTrue (regrtest .print_slowest )
@@ -466,6 +487,15 @@ def test_slow_ci(self):
466
487
regrtest = self .check_ci_mode (args , use_resources )
467
488
self .assertEqual (regrtest .timeout , 20 * 60 )
468
489
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
+
469
499
def test_dont_add_python_opts (self ):
470
500
args = ['--dont-add-python-opts' ]
471
501
ns = cmdline ._parse_args (args )
0 commit comments