https://github.com/python/cpython/commit/69f54ce4523174860a92271e3cec5c498f89627f
commit: 69f54ce4523174860a92271e3cec5c498f89627f
branch: main
author: Miro HronĨok <[email protected]>
committer: brettcannon <[email protected]>
date: 2025-11-27T10:00:02-08:00
summary:
gh-140210: Make test_sysconfig.test_parse_makefile_renamed_vars ignore
environment variables (#140213)
The test did not expect it could be run with e.g. CFLAGS set to a custom value.
files:
A Misc/NEWS.d/next/Tests/2025-10-16-15-08-58.gh-issue-140210.P9vUP8.rst
M Lib/test/test_sysconfig.py
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 8101657b04a5c6..502103ce629358 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -20,7 +20,7 @@
)
from test.support.import_helper import import_module
from test.support.os_helper import (TESTFN, unlink, skip_unless_symlink,
- change_cwd)
+ change_cwd, EnvironmentVarGuard)
from test.support.venv import VirtualEnvironmentMixin
import sysconfig
@@ -807,7 +807,9 @@ def test_parse_makefile_renamed_vars(self):
print("PY_LDFLAGS=-lm", file=makefile)
print("var2=$(LDFLAGS)", file=makefile)
print("var3=$(CPPFLAGS)", file=makefile)
- vars = _parse_makefile(TESTFN)
+ with EnvironmentVarGuard() as env:
+ env.clear()
+ vars = _parse_makefile(TESTFN)
self.assertEqual(vars, {
'var1': '-Wall',
'CFLAGS': '-Wall',
diff --git
a/Misc/NEWS.d/next/Tests/2025-10-16-15-08-58.gh-issue-140210.P9vUP8.rst
b/Misc/NEWS.d/next/Tests/2025-10-16-15-08-58.gh-issue-140210.P9vUP8.rst
new file mode 100644
index 00000000000000..f2064bfd377e69
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2025-10-16-15-08-58.gh-issue-140210.P9vUP8.rst
@@ -0,0 +1,2 @@
+Make ``test_sysconfig.test_parse_makefile_renamed_vars`` less fragile by
+clearing the environment variables before parsing the Makefile.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]