mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-137242: Allow Android testbed to take all Python command-line options (GH-138805) (#139637)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
This commit is contained in:
parent
bb212a1a8b
commit
f776254080
7 changed files with 152 additions and 129 deletions
|
|
@ -646,15 +646,23 @@ def _add_cross_compile_opts(self, regrtest_opts):
|
|||
return (environ, keep_environ)
|
||||
|
||||
def _add_ci_python_opts(self, python_opts, keep_environ):
|
||||
# --fast-ci and --slow-ci add options to Python:
|
||||
# "-u -W default -bb -E"
|
||||
# --fast-ci and --slow-ci add options to Python.
|
||||
#
|
||||
# Some platforms run tests in embedded mode and cannot change options
|
||||
# after startup, so if this function changes, consider also updating:
|
||||
# * gradle_task in Android/android.py
|
||||
|
||||
# Unbuffered stdout and stderr
|
||||
if not sys.stdout.write_through:
|
||||
# Unbuffered stdout and stderr. This isn't helpful on Android, because
|
||||
# it would cause lines to be split into multiple log messages.
|
||||
if not sys.stdout.write_through and sys.platform != "android":
|
||||
python_opts.append('-u')
|
||||
|
||||
# Add warnings filter 'error'
|
||||
if 'default' not in sys.warnoptions:
|
||||
# Add warnings filter 'error', unless the user specified a different
|
||||
# filter. Ignore BytesWarning since it's controlled by '-b' below.
|
||||
if not [
|
||||
opt for opt in sys.warnoptions
|
||||
if not opt.endswith("::BytesWarning")
|
||||
]:
|
||||
python_opts.extend(('-W', 'error'))
|
||||
|
||||
# Error on bytes/str comparison
|
||||
|
|
@ -673,8 +681,12 @@ def _execute_python(self, cmd, environ):
|
|||
|
||||
cmd_text = shlex.join(cmd)
|
||||
try:
|
||||
print(f"+ {cmd_text}", flush=True)
|
||||
# Android and iOS run tests in embedded mode. To update their
|
||||
# Python options, see the comment in _add_ci_python_opts.
|
||||
if not cmd[0]:
|
||||
raise ValueError("No Python executable is present")
|
||||
|
||||
print(f"+ {cmd_text}", flush=True)
|
||||
if hasattr(os, 'execv') and not MS_WINDOWS:
|
||||
os.execv(cmd[0], cmd)
|
||||
# On success, execv() do no return.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue