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.
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
MOCK_PACKAGE_DIR = Path("some_package_dir")
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
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-cp38-universal2",
|
|
action="store_true",
|
|
default=False,
|
|
help="macOS cp38 uses the universal2 installer",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def fake_package_dir(tmp_path, monkeypatch):
|
|
"""
|
|
Monkey-patch enough for the main() function to run
|
|
"""
|
|
real_path_exists = Path.exists
|
|
|
|
def mock_path_exists(path):
|
|
if str(path).endswith(str(MOCK_PACKAGE_DIR / "setup.py")):
|
|
return True
|
|
else:
|
|
return real_path_exists(path)
|
|
|
|
args = ["cibuildwheel", str(MOCK_PACKAGE_DIR)]
|
|
tmp_path.joinpath(MOCK_PACKAGE_DIR).mkdir()
|
|
monkeypatch.setattr(Path, "exists", mock_path_exists)
|
|
monkeypatch.setattr(sys, "argv", args)
|
|
monkeypatch.chdir(tmp_path)
|
|
return args
|