summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-27 10:01:16 (GMT)
committerGitHub <noreply@github.com>2023-09-27 10:01:16 (GMT)
commit91fb8daa2494df4dd6a841ca8c742a03175c7ecd (patch)
tree69cf7d8fc8f8108ac9804f690849856bf88563dd /Lib/test/test_regrtest.py
parentb1aebf1e6576680d606068d17e2208259573e061 (diff)
downloadcpython-91fb8daa2494df4dd6a841ca8c742a03175c7ecd.zip
cpython-91fb8daa2494df4dd6a841ca8c742a03175c7ecd.tar.gz
cpython-91fb8daa2494df4dd6a841ca8c742a03175c7ecd.tar.bz2
gh-109566: Fix regrtest Python options for WASM/WASI (#109954)
WASM and WASI buildbots use multiple PYTHON environment variables such as PYTHONPATH and _PYTHON_HOSTRUNNER. Don't use -E if the --python=COMMAND option is used.
Diffstat (limited to 'Lib/test/test_regrtest.py')
-rw-r--r--Lib/test/test_regrtest.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 3ece31b..e0568cb 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1965,16 +1965,20 @@ class ArgsTestCase(BaseTestCase):
self.check_executed_tests(output, tests,
stats=len(tests), parallel=True)
- def check_reexec(self, option):
+ def check_add_python_opts(self, option):
# --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python
code = textwrap.dedent(r"""
import sys
import unittest
+ from test import support
try:
from _testinternalcapi import get_config
except ImportError:
get_config = None
+ # WASI/WASM buildbots don't use -E option
+ use_environment = (support.is_emscripten or support.is_wasi)
+
class WorkerTests(unittest.TestCase):
@unittest.skipUnless(get_config is None, 'need get_config()')
def test_config(self):
@@ -1986,7 +1990,7 @@ class ArgsTestCase(BaseTestCase):
# -bb option
self.assertTrue(config['bytes_warning'], 2)
# -E option
- self.assertTrue(config['use_environment'], 0)
+ self.assertTrue(config['use_environment'], use_environment)
def test_python_opts(self):
# -u option
@@ -2000,7 +2004,8 @@ class ArgsTestCase(BaseTestCase):
self.assertEqual(sys.flags.bytes_warning, 2)
# -E option
- self.assertTrue(sys.flags.ignore_environment)
+ self.assertEqual(not sys.flags.ignore_environment,
+ use_environment)
""")
testname = self.create_test(code=code)
@@ -2018,7 +2023,7 @@ class ArgsTestCase(BaseTestCase):
def test_add_python_opts(self):
for opt in ("--fast-ci", "--slow-ci"):
with self.subTest(opt=opt):
- self.check_reexec(opt)
+ self.check_add_python_opts(opt)
class TestUtils(unittest.TestCase):