Skip to content

Commit 5d80a99

Browse files
committed
mingw_smoketests: add a test to check if sysconfig returns correct values for LIBDIR
1 parent a98b841 commit 5d80a99

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

mingw_smoketests.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ def test_platform_things(self):
218218
import sysconfig
219219
import platform
220220
import importlib.machinery
221+
import tempfile
222+
import venv
223+
import subprocess
221224
self.assertEqual(sys.implementation.name, "cpython")
222225
self.assertEqual(sys.platform, "win32")
223226
self.assertTrue(sysconfig.get_platform().startswith("mingw"))
@@ -241,6 +244,21 @@ def test_platform_things(self):
241244
self.assertEqual(platform.system(), "Windows")
242245
self.assertTrue(isinstance(sys.api_version, int) and sys.api_version > 0)
243246

247+
with tempfile.TemporaryDirectory() as tmp:
248+
builder = venv.EnvBuilder()
249+
builder.create(tmp)
250+
# This will not work in in-tree build
251+
if not sysconfig.is_python_build():
252+
op = subprocess.check_output(
253+
[
254+
os.path.join(tmp, "bin", "python.exe"),
255+
"-c",
256+
"import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"
257+
],
258+
cwd=tmp,
259+
)
260+
self.assertTrue(op.decode().strip().startswith(sys.base_prefix))
261+
244262
def test_sys_getpath(self):
245263
# everything sourced from getpath.py
246264
import sys

0 commit comments

Comments
 (0)