@@ -155,7 +155,7 @@ def __init__(self, **kwargs) -> None:
155155 self .list_cases = False
156156 self .list_tests = False
157157 self .single = False
158- self .randomize = None
158+ self .randomize = False
159159 self .fromfile = None
160160 self .fail_env_changed = False
161161 self .use_resources : list [str ] = []
@@ -271,7 +271,7 @@ def _create_parser():
271271 group = parser .add_argument_group ('Selecting tests' )
272272 group .add_argument ('-r' , '--randomize' , action = 'store_true' ,
273273 help = 'randomize test execution order.' + more_details )
274- group .add_argument ('--no-randomize' , dest = 'randomize ' , action = 'store_false ' ,
274+ group .add_argument ('--no-randomize' , dest = 'no_randomize ' , action = 'store_true ' ,
275275 help = 'do not randomize test execution order, even if '
276276 'it would be implied by another option' )
277277 group .add_argument ('--prioritize' , metavar = 'TEST1,TEST2,...' ,
@@ -459,8 +459,7 @@ def _parse_args(args, **kwargs):
459459 # -j0 --randomize --fail-env-changed --rerun --slowest --verbose3
460460 if ns .use_mp is None :
461461 ns .use_mp = 0
462- if ns .randomize is None :
463- ns .randomize = True
462+ ns .randomize = True
464463 ns .fail_env_changed = True
465464 if ns .python is None :
466465 ns .rerun = True
@@ -541,8 +540,10 @@ def _parse_args(args, **kwargs):
541540 ns .use_resources .remove (r )
542541 elif r not in ns .use_resources :
543542 ns .use_resources .append (r )
544- if ns .random_seed is not None and ns . randomize is None :
543+ if ns .random_seed is not None :
545544 ns .randomize = True
545+ if ns .no_randomize :
546+ ns .randomize = False
546547 if ns .verbose :
547548 ns .header = True
548549
0 commit comments