From c7e9b9f4c5c6aa86598a2a5a845784bebdbbac11 Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Wed, 8 Nov 2023 19:44:22 +0530
Subject: [PATCH 103/N] mingw_smoketests: add a test to check if sysconfig
 returns correct values for `LIBDIR`

---
 mingw_smoketests.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/mingw_smoketests.py b/mingw_smoketests.py
index ca1f652..4f81c68 100644
--- a/mingw_smoketests.py
+++ b/mingw_smoketests.py
@@ -218,6 +218,9 @@ class Tests(unittest.TestCase):
         import sysconfig
         import platform
         import importlib.machinery
+        import tempfile
+        import venv
+        import subprocess
         self.assertEqual(sys.implementation.name, "cpython")
         self.assertEqual(sys.platform, "win32")
         self.assertTrue(sysconfig.get_platform().startswith("mingw"))
@@ -241,6 +244,21 @@ class Tests(unittest.TestCase):
         self.assertEqual(platform.system(), "Windows")
         self.assertTrue(isinstance(sys.api_version, int) and sys.api_version > 0)
 
+        with tempfile.TemporaryDirectory() as tmp:
+            builder = venv.EnvBuilder()
+            builder.create(tmp)
+            # This will not work in in-tree build
+            if not sysconfig.is_python_build():
+                op = subprocess.check_output(
+                    [
+                        os.path.join(tmp, "bin", "python.exe"),
+                        "-c",
+                        "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"
+                    ],
+                    cwd=tmp,
+                )
+                self.assertTrue(op.decode().strip().startswith(sys.base_prefix))
+
     def test_sys_getpath(self):
         # everything sourced from getpath.py
         import sys
