From cd40db713b5e48819e85da63806f487763b27287 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 25 Sep 2022 10:42:19 +0200 Subject: [PATCH] feature: allow testing cp38-macosx_arm64 wheel Per discussion in https://github.com/pypa/cibuildwheel/pull/1169, the default installer used for cp38 is an Intel installer. It makes sense to skip testing arm64 wheels in this case. However, if the user choose to manually install the universal2 CPython version, then, tests shall be run on arm64. This allows users that either target 11.0+ on intel, universal2 or only build for arm64 to get the arm64 wheel tested on AppleSilicon. --- cibuildwheel/macos.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index db863504e..95bbe268c 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -425,6 +425,13 @@ def build(options: Options, tmp_path: Path) -> None: if build_options.test_command and build_options.test_selector(config.identifier): machine_arch = platform.machine() + python_arch = call( + "python", + "-sSc", + "import platform; print(platform.machine())", + env=env, + capture_stdout=True, + ).strip() testing_archs: list[Literal["x86_64", "arm64"]] if config_is_arm64: @@ -473,7 +480,8 @@ def build(options: Options, tmp_path: Path) -> None: # skip this test continue - if testing_arch == "arm64" and config.identifier.startswith("cp38-"): + is_cp38 = config.identifier.startswith("cp38-") + if testing_arch == "arm64" and is_cp38 and python_arch != "arm64": log.warning( unwrap( """