-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
gh-137242: Add a --no-randomize
option, and use it in Android CI
#138303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ def __init__(self, **kwargs) -> None: | |
self.list_cases = False | ||
self.list_tests = False | ||
self.single = False | ||
self.randomize = False | ||
self.randomize = None | ||
self.fromfile = None | ||
self.fail_env_changed = False | ||
self.use_resources: list[str] = [] | ||
|
@@ -271,6 +271,9 @@ def _create_parser(): | |
group = parser.add_argument_group('Selecting tests') | ||
group.add_argument('-r', '--randomize', action='store_true', | ||
help='randomize test execution order.' + more_details) | ||
group.add_argument('--no-randomize', dest='randomize', action='store_false', | ||
help='do not randomize test execution order, even if ' | ||
'it would be implied by another option') | ||
group.add_argument('--prioritize', metavar='TEST1,TEST2,...', | ||
action='append', type=priority_list, | ||
help='select these tests first, even if the order is' | ||
|
@@ -456,7 +459,8 @@ def _parse_args(args, **kwargs): | |
# -j0 --randomize --fail-env-changed --rerun --slowest --verbose3 | ||
if ns.use_mp is None: | ||
ns.use_mp = 0 | ||
ns.randomize = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to keep randomization for --fast-ci and --slow-ci options. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer adding an option to disable randomization, option which could be used with --fast-ci / --slow-ci. |
||
if ns.randomize is None: | ||
ns.randomize = True | ||
ns.fail_env_changed = True | ||
if ns.python is None: | ||
ns.rerun = True | ||
|
@@ -537,7 +541,7 @@ def _parse_args(args, **kwargs): | |
ns.use_resources.remove(r) | ||
elif r not in ns.use_resources: | ||
ns.use_resources.append(r) | ||
if ns.random_seed is not None: | ||
if ns.random_seed is not None and ns.randomize is None: | ||
ns.randomize = True | ||
if ns.verbose: | ||
ns.header = True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer avoiding None for randomize and keep a boolean instead. I wrote #138649 which is a clone of this PR with my additional change avoiding None. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense; I'll close this PR in favor of that one.