From 97bec8ecf213e065f1da2e1f783c99abbb1a4332 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Tue, 19 May 2026 08:03:08 -0700 Subject: [PATCH 1/2] Pass `-E` to subprocesses from `check_add_python_opts` Avoid the runtime environment from affecting the tests' behaviours, which notably checks the warning filters which can be controlled by various environment variables. --- Lib/test/test_regrtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index 02f6e0c74b5ce8..45c05242537632 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -2277,7 +2277,7 @@ def test_python_opts(self): # Use directly subprocess to control the exact command line cmd = [sys.executable, - "-m", "test", option, + "-E", "-m", "test", option, f'--testdir={self.tmptestdir}', testname] proc = subprocess.run(cmd, From fb82f0c7c2bdc09cd0b58d12288bfb60045d8cac Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Tue, 19 May 2026 08:10:31 -0700 Subject: [PATCH 2/2] Add blurb --- .../next/Tests/2026-05-19-08-10-20.gh-issue-150046.MndDD8.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2026-05-19-08-10-20.gh-issue-150046.MndDD8.rst diff --git a/Misc/NEWS.d/next/Tests/2026-05-19-08-10-20.gh-issue-150046.MndDD8.rst b/Misc/NEWS.d/next/Tests/2026-05-19-08-10-20.gh-issue-150046.MndDD8.rst new file mode 100644 index 00000000000000..b322922e108690 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-05-19-08-10-20.gh-issue-150046.MndDD8.rst @@ -0,0 +1 @@ +Avoid ``PYTHON*`` environment variables affecting regrtest's own tests.