From 7216992c844423a76575db3e521d3bc181128e63 Mon Sep 17 00:00:00 2001 From: Ronit Baldaniya Date: Tue, 14 Jul 2026 07:11:32 -0500 Subject: [PATCH] test: cover native-Windows platform detection without uname (#145) --- c/tests/test_makefile_platform.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 c/tests/test_makefile_platform.py diff --git a/c/tests/test_makefile_platform.py b/c/tests/test_makefile_platform.py new file mode 100644 index 0000000..5b8c558 --- /dev/null +++ b/c/tests/test_makefile_platform.py @@ -0,0 +1,34 @@ +import os +import shutil +import subprocess +import unittest +from pathlib import Path + + +C_DIR = Path(__file__).resolve().parents[1] +MAKE = shutil.which("make") + + +@unittest.skipUnless(MAKE, "make is required") +class MakefilePlatformTests(unittest.TestCase): + def test_windows_nt_without_uname_selects_mingw_build(self): + env = os.environ.copy() + env["OS"] = "Windows_NT" + env["PATH"] = "" + + result = subprocess.run( + [MAKE, "--no-print-directory", "-B", "-n", "glm"], + cwd=C_DIR, + env=env, + text=True, + capture_output=True, + check=True, + ) + + self.assertIn("-o glm.exe", result.stdout) + self.assertIn("-fopenmp", result.stdout) + self.assertIn("-static", result.stdout) + + +if __name__ == "__main__": + unittest.main()