Skip to content

bpo-40003: test.bisect_cmd copies Python options #19246

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

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Lib/test/bisect_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ def format_shell_args(args):
return ' '.join(args)


def python_cmd():
cmd = [sys.executable]
cmd.extend(subprocess._args_from_interpreter_flags())
cmd.extend(subprocess._optim_args_from_interpreter_flags())
return cmd


def list_cases(args):
cmd = [sys.executable, '-m', 'test', '--list-cases']
cmd = python_cmd()
cmd.extend(['-m', 'test', '--list-cases'])
cmd.extend(args.test_args)
proc = subprocess.run(cmd,
stdout=subprocess.PIPE,
Expand All @@ -68,7 +76,8 @@ def run_tests(args, tests, huntrleaks=None):
try:
write_tests(tmp, tests)

cmd = [sys.executable, '-m', 'test', '--matchfile', tmp]
cmd = python_cmd()
cmd.extend(['-m', 'test', '--matchfile', tmp])
cmd.extend(args.test_args)
print("+ %s" % format_shell_args(cmd))
proc = subprocess.run(cmd)
Expand Down Expand Up @@ -100,6 +109,9 @@ def parse_args():

def main():
args = parse_args()
if '-w' in args.test_args or '--verbose2' in args.test_args:
print("WARNING: -w/--verbose2 option should not be used to bisect!")
print()

if args.input:
with open(args.input) as fp:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``test.bisect_cmd`` now copies Python command line options like ``-O`` or
``-W``. Moreover, emit a warning if ``test.bisect_cmd`` is used with
``-w``/``--verbose2`` option.