mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
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.
This commit is contained in:
parent
e02801dc37
commit
69f54ce452
2 changed files with 6 additions and 2 deletions
|
|
@ -20,7 +20,7 @@
|
||||||
)
|
)
|
||||||
from test.support.import_helper import import_module
|
from test.support.import_helper import import_module
|
||||||
from test.support.os_helper import (TESTFN, unlink, skip_unless_symlink,
|
from test.support.os_helper import (TESTFN, unlink, skip_unless_symlink,
|
||||||
change_cwd)
|
change_cwd, EnvironmentVarGuard)
|
||||||
from test.support.venv import VirtualEnvironmentMixin
|
from test.support.venv import VirtualEnvironmentMixin
|
||||||
|
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
|
@ -807,7 +807,9 @@ def test_parse_makefile_renamed_vars(self):
|
||||||
print("PY_LDFLAGS=-lm", file=makefile)
|
print("PY_LDFLAGS=-lm", file=makefile)
|
||||||
print("var2=$(LDFLAGS)", file=makefile)
|
print("var2=$(LDFLAGS)", file=makefile)
|
||||||
print("var3=$(CPPFLAGS)", file=makefile)
|
print("var3=$(CPPFLAGS)", file=makefile)
|
||||||
vars = _parse_makefile(TESTFN)
|
with EnvironmentVarGuard() as env:
|
||||||
|
env.clear()
|
||||||
|
vars = _parse_makefile(TESTFN)
|
||||||
self.assertEqual(vars, {
|
self.assertEqual(vars, {
|
||||||
'var1': '-Wall',
|
'var1': '-Wall',
|
||||||
'CFLAGS': '-Wall',
|
'CFLAGS': '-Wall',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Make ``test_sysconfig.test_parse_makefile_renamed_vars`` less fragile by
|
||||||
|
clearing the environment variables before parsing the Makefile.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue