Merge pull request #1283 from mayeut/test-macos-cp38-arm64
feature: allow testing cp38-macosx_arm64 wheel
This commit is contained in:
+16
@@ -56,3 +56,19 @@ macos_arm64_task:
|
|||||||
- brew install python@3.10
|
- brew install python@3.10
|
||||||
- ln -s python3 /opt/homebrew/opt/python@3.10/bin/python
|
- ln -s python3 /opt/homebrew/opt/python@3.10/bin/python
|
||||||
<<: *RUN_TESTS
|
<<: *RUN_TESTS
|
||||||
|
|
||||||
|
macos_arm64_cp38_task:
|
||||||
|
macos_instance:
|
||||||
|
image: ghcr.io/cirruslabs/macos-monterey-xcode
|
||||||
|
|
||||||
|
env:
|
||||||
|
PATH: /opt/homebrew/opt/python@3.10/bin:$PATH
|
||||||
|
PYTEST_ADDOPTS: --run-cp38-universal2 -k 'test_cp38_arm64_testing_universal2_installer or test_arch_auto'
|
||||||
|
install_pre_requirements_script:
|
||||||
|
- brew install python@3.10
|
||||||
|
- ln -s python3 /opt/homebrew/opt/python@3.10/bin/python
|
||||||
|
- curl -fsSLO https://www.python.org/ftp/python/3.8.10/python-3.8.10-macos11.pkg
|
||||||
|
- sudo installer -pkg python-3.8.10-macos11.pkg -target /
|
||||||
|
- rm python-3.8.10-macos11.pkg
|
||||||
|
- sh "/Applications/Python 3.8/Install Certificates.command"
|
||||||
|
<<: *RUN_TESTS
|
||||||
|
|||||||
@@ -425,6 +425,13 @@ def build(options: Options, tmp_path: Path) -> None:
|
|||||||
|
|
||||||
if build_options.test_command and build_options.test_selector(config.identifier):
|
if build_options.test_command and build_options.test_selector(config.identifier):
|
||||||
machine_arch = platform.machine()
|
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"]]
|
testing_archs: list[Literal["x86_64", "arm64"]]
|
||||||
|
|
||||||
if config_is_arm64:
|
if config_is_arm64:
|
||||||
@@ -473,7 +480,8 @@ def build(options: Options, tmp_path: Path) -> None:
|
|||||||
# skip this test
|
# skip this test
|
||||||
continue
|
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(
|
log.warning(
|
||||||
unwrap(
|
unwrap(
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ def pytest_addoption(parser) -> None:
|
|||||||
"--run-emulation", action="store_true", default=False, help="run emulation tests"
|
"--run-emulation", action="store_true", default=False, help="run emulation tests"
|
||||||
)
|
)
|
||||||
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
|
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
|
||||||
|
parser.addoption(
|
||||||
|
"--run-cp38-universal2",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="macOS cp38 uses the universal2 installer",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
|
|||||||
@@ -167,3 +167,33 @@ def test_cp38_arm64_testing(tmp_path, capfd):
|
|||||||
expected_wheels = [w for w in ALL_MACOS_WHEELS if "cp38" in w]
|
expected_wheels = [w for w in ALL_MACOS_WHEELS if "cp38" in w]
|
||||||
|
|
||||||
assert set(actual_wheels) == set(expected_wheels)
|
assert set(actual_wheels) == set(expected_wheels)
|
||||||
|
|
||||||
|
|
||||||
|
def test_cp38_arm64_testing_universal2_installer(tmp_path, capfd, request):
|
||||||
|
if not request.config.getoption("--run-cp38-universal2"):
|
||||||
|
pytest.skip("needs --run-cp38-universal2 option to run")
|
||||||
|
|
||||||
|
project_dir = tmp_path / "project"
|
||||||
|
basic_project.generate(project_dir)
|
||||||
|
|
||||||
|
actual_wheels = utils.cibuildwheel_run(
|
||||||
|
project_dir,
|
||||||
|
add_env={
|
||||||
|
"CIBW_BUILD": "cp38-*",
|
||||||
|
"CIBW_TEST_COMMAND": '''python -c "import platform; print('running tests on ' + platform.machine())"''',
|
||||||
|
"CIBW_ARCHS": "x86_64,universal2,arm64",
|
||||||
|
"MACOSX_DEPLOYMENT_TARGET": "11.0",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
captured = capfd.readouterr()
|
||||||
|
|
||||||
|
assert "running tests on x86_64" in captured.out
|
||||||
|
assert "running tests on arm64" in captured.out
|
||||||
|
|
||||||
|
warning_message = "While cibuildwheel can build CPython 3.8 universal2/arm64 wheels, we cannot test the arm64 part of them"
|
||||||
|
assert warning_message not in captured.err
|
||||||
|
|
||||||
|
expected_wheels = [w.replace("10_9", "11_0") for w in ALL_MACOS_WHEELS if "cp38" in w]
|
||||||
|
|
||||||
|
assert set(actual_wheels) == set(expected_wheels)
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ MOCK_PACKAGE_DIR = Path("some_package_dir")
|
|||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption("--run-docker", action="store_true", default=False, help="run docker tests")
|
parser.addoption("--run-docker", action="store_true", default=False, help="run docker tests")
|
||||||
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
|
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
|
||||||
|
parser.addoption(
|
||||||
|
"--run-cp38-universal2",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="macOS cp38 uses the universal2 installer",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in New Issue
Block a user