From 9dbaa5e16c343976415891fc371941d99ed6e210 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Thu, 28 May 2026 17:48:51 +0100 Subject: [PATCH] gh-150046: Fix `test_add_python_opts` to ignore `PYTHON*` env vars (GH-150089) Avoid the runtime environment from affecting the tests' behaviours, which notably checks the warning filters which can be controlled by various PYTHON environment variables. (cherry picked from commit ef2246f788832a64ba7c5215c8e72f8e539e59b4) Co-authored-by: Pradyun Gedam --- Lib/test/test_regrtest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index 02f6e0c74b5ce8..874c6bb76b1afe 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -2283,7 +2283,8 @@ def test_python_opts(self): proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - text=True) + text=True, + env=support.make_clean_env()) self.assertEqual(proc.returncode, 0, proc) def test_add_python_opts(self):