Improve integration test options (#2385)

* Improve integration test options

- Keep the platform and enable options in os.environ, don't duplicate state in utils
- Provide more user-friendly options for setting enable and platform in integration tests

* Ensure that CIBW_ENABLE is set in the test process

* Use get_enable_groups() where necessary
This commit is contained in:
Joe Rickerby
2025-05-16 11:11:16 +01:00
committed by GitHub
parent 166465b56d
commit 1bc7e904b8
24 changed files with 130 additions and 75 deletions
+4 -4
View File
@@ -57,7 +57,7 @@ def test_cpp11(tmp_path):
project_dir = tmp_path / "project"
cpp11_project = cpp_test_project.copy()
cpp11_project.template_context["extra_compile_args"] = (
["/std:c++11"] if utils.platform == "windows" else ["-std=c++11"]
["/std:c++11"] if utils.get_platform() == "windows" else ["-std=c++11"]
)
cpp11_project.template_context["spam_cpp_top_level_add"] = "#include <array>"
cpp11_project.generate(project_dir)
@@ -73,7 +73,7 @@ def test_cpp14(tmp_path):
project_dir = tmp_path / "project"
cpp14_project = cpp_test_project.copy()
cpp14_project.template_context["extra_compile_args"] = (
["/std:c++14"] if utils.platform == "windows" else ["-std=c++14"]
["/std:c++14"] if utils.get_platform() == "windows" else ["-std=c++14"]
)
cpp14_project.template_context["spam_cpp_top_level_add"] = "int a = 100'000;"
cpp14_project.generate(project_dir)
@@ -89,7 +89,7 @@ def test_cpp17(tmp_path):
project_dir = tmp_path / "project"
cpp17_project = cpp_test_project.copy()
cpp17_project.template_context["extra_compile_args"] = [
"/std:c++17" if utils.platform == "windows" else "-std=c++17"
"/std:c++17" if utils.get_platform() == "windows" else "-std=c++17"
]
cpp17_project.template_context["spam_cpp_top_level_add"] = r"""
#include <utility>
@@ -98,7 +98,7 @@ def test_cpp17(tmp_path):
cpp17_project.generate(project_dir)
add_env = {}
if utils.platform == "macos":
if utils.get_platform() == "macos":
add_env["MACOSX_DEPLOYMENT_TARGET"] = "10.13"
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env, single_python=True)