Skip to content

Commit 5780092

Browse files
authored
Don't attempt to test CPython 3.8 wheels on Apple Silicon. (#1171)
I've added a warning for users, so they know that it doesn't get tested. See discussion in #1169 for the reason why. Fixes #1168, fixes #1169
1 parent 88d432c commit 5780092

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

cibuildwheel/macos.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,23 @@ def build(options: Options, tmp_path: Path) -> None:
465465
# skip this test
466466
continue
467467

468+
if testing_arch == "arm64" and config.identifier.startswith("cp38-"):
469+
log.warning(
470+
unwrap(
471+
"""
472+
While cibuildwheel can build CPython 3.8 universal2/arm64 wheels, we
473+
cannot test the arm64 part of them, even when running on an Apple
474+
Silicon machine. This is because we use the x86_64 installer of
475+
CPython 3.8. See the discussion in
476+
https://github.com/pypa/cibuildwheel/pull/1169 for the details. To
477+
silence this warning, set `CIBW_TEST_SKIP: cp38-macosx_*:arm64`.
478+
"""
479+
)
480+
)
481+
482+
# skip this test
483+
continue
484+
468485
log.step(
469486
"Testing wheel..."
470487
if testing_arch == machine_arch

test/test_macos_archs.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,36 @@ def test_universal2_testing(tmp_path, capfd, skip_arm64_test):
133133
expected_wheels = [w for w in ALL_MACOS_WHEELS if "cp39" in w and "universal2" in w]
134134

135135
assert set(actual_wheels) == set(expected_wheels)
136+
137+
138+
def test_cp38_arm64_testing(tmp_path, capfd):
139+
if utils.platform != "macos":
140+
pytest.skip("this test is only relevant to macos")
141+
if get_xcode_version() < (12, 2):
142+
pytest.skip("this test only works with Xcode 12.2 or greater")
143+
if platform.machine() != "arm64":
144+
pytest.skip("this test only works on arm64")
145+
146+
project_dir = tmp_path / "project"
147+
basic_project.generate(project_dir)
148+
149+
actual_wheels = utils.cibuildwheel_run(
150+
project_dir,
151+
add_env={
152+
"CIBW_BUILD": "cp38-*",
153+
"CIBW_TEST_COMMAND": '''python -c "import platform; print('running tests on ' + platform.machine())"''',
154+
"CIBW_ARCHS": "x86_64,universal2,arm64",
155+
},
156+
)
157+
158+
captured = capfd.readouterr()
159+
160+
assert "running tests on x86_64" in captured.out
161+
assert "running tests on arm64" not in captured.out
162+
163+
warning_message = "While cibuildwheel can build CPython 3.8 universal2/arm64 wheels, we cannot test the arm64 part of them"
164+
assert warning_message in captured.err
165+
166+
expected_wheels = [w for w in ALL_MACOS_WHEELS if "cp38" in w]
167+
168+
assert set(actual_wheels) == set(expected_wheels)

test/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def expected_wheels(
154154
python_abi_tags += ["pp37-pypy37_pp73", "pp38-pypy38_pp73", "pp39-pypy39_pp73"]
155155

156156
if platform == "macos" and machine_arch == "arm64":
157-
# currently, arm64 macs are only supported by cp39, cp310 & cp311
158-
python_abi_tags = ["cp39-cp39", "cp310-cp310", "cp311-cp311"]
157+
# arm64 macs are only supported by cp38+
158+
python_abi_tags = ["cp38-cp38", "cp39-cp39", "cp310-cp310", "cp311-cp311"]
159159

160160
wheels = []
161161

@@ -193,7 +193,7 @@ def expected_wheels(
193193
platform_tags = ["win32", "win_amd64"]
194194

195195
elif platform == "macos":
196-
if python_abi_tag == "cp39-cp39" and machine_arch == "arm64":
196+
if machine_arch == "arm64":
197197
arm64_macosx_deployment_target = _get_arm64_macosx_deployment_target(
198198
macosx_deployment_target
199199
)

0 commit comments

Comments
 (0)