gh-133951: Fix purelib packages not found in test_peg_generator TestCParser (GH-139607)

also includes purelib in TestCParser import context
This commit is contained in:
Cycloctane 2025-10-06 20:40:48 +08:00 committed by GitHub
parent 36a6c2cdfa
commit b73aaffb3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,11 +100,15 @@ def setUpClass(cls):
with contextlib.ExitStack() as stack:
python_exe = stack.enter_context(support.setup_venv_with_pip_setuptools("venv"))
sitepackages = subprocess.check_output(
platlib_path = subprocess.check_output(
[python_exe, "-c", "import sysconfig; print(sysconfig.get_path('platlib'))"],
text=True,
).strip()
stack.enter_context(import_helper.DirsOnSysPath(sitepackages))
purelib_path = subprocess.check_output(
[python_exe, "-c", "import sysconfig; print(sysconfig.get_path('purelib'))"],
text=True,
).strip()
stack.enter_context(import_helper.DirsOnSysPath(platlib_path, purelib_path))
cls.addClassCleanup(stack.pop_all().close)
@support.requires_venv_with_pip()