* Add support for building iOS wheels. * Replace use of system() in test binary module. * Restored the 'minimal' approach of the minimal examples. * Split out platform details into standalone pages, and expand iOS platform details. * More doc corrections. * Bump support package to include fix for python/cpython#130292 * Ensure iOS tests are all run on the same xdist worker. * More iOS documentation tweaks. * Factor out common xcode version test utility. * Simplify iOS to a single platform with an expanded interpretation of arch. * I guess I should update the iOS tests as well... * Additional safety for missing iOS test output. * Remove DYLD_LIBRARY_PATH from the iOS environment. * Make test-sources mandatory for iOS builds. * Updates and clarifications to documentation. * Clarify what a slice is. * Normalize use of underscores in platform name. * Modify auto target to be matching CPU only. * Use consistent ordering of platforms in examples. * Use consistent naming in iOS archiectures. * Placate the linter. * Miscellaneous cleanups picked up by @joerick's review. * Correct the list of expected wheels. * Correct which 'native' we're actually checking. * Correct the docs links so they're all relative. * Correct the identification of free threaded builds. * Use target instead of host to describe the platform we're building for. * Rework iOS test to remove issue with log completeness. * Convert errors to FatalError Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com> Co-authored-by: Joe Rickerby <joerick@mac.com> * Removed a repeated check for a valid python. * Update bin/update_pythons.py to update iOS support packages. * Document that iOS CI is available on other platforms. * Restore a comment needed for some platforms. * Small cleanups identified in code review Co-authored-by: Joe Rickerby <joerick@mac.com> * Simplify logic to appease linter. * Modify dependency constraint handling to use new API. * Cosmetic change to trigger a CI rebuild. --------- Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com> Co-authored-by: Joe Rickerby <joerick@mac.com>
66 lines
1.7 KiB
Python
66 lines
1.7 KiB
Python
import itertools
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from . import test_projects, utils
|
|
|
|
project_with_a_test = test_projects.new_c_project()
|
|
|
|
project_with_a_test.files["test/spam_test.py"] = r"""
|
|
import spam
|
|
|
|
def test_spam():
|
|
assert spam.filter("spam") == 0
|
|
assert spam.filter("ham") != 0
|
|
"""
|
|
|
|
|
|
def test(tmp_path, request):
|
|
archs = request.config.getoption("--run-emulation")
|
|
if archs is None:
|
|
pytest.skip("needs --run-emulation option to run")
|
|
|
|
if archs == "all":
|
|
archs = " ".join(utils.EMULATED_ARCHS)
|
|
|
|
project_dir = tmp_path / "project"
|
|
project_with_a_test.generate(project_dir)
|
|
|
|
# build and test the wheels
|
|
actual_wheels = utils.cibuildwheel_run(
|
|
project_dir,
|
|
add_env={
|
|
"CIBW_TEST_REQUIRES": "pytest",
|
|
"CIBW_TEST_COMMAND": "pytest {project}/test",
|
|
"CIBW_ARCHS": archs,
|
|
},
|
|
)
|
|
|
|
# also check that we got the right wheels
|
|
expected_wheels = itertools.chain.from_iterable(
|
|
utils.expected_wheels("spam", "0.1.0", machine_arch=arch, single_arch=True)
|
|
for arch in archs.split(" ")
|
|
)
|
|
assert set(actual_wheels) == set(expected_wheels)
|
|
|
|
|
|
def test_setting_arch_on_other_platforms(tmp_path, capfd):
|
|
if utils.platform == "linux":
|
|
pytest.skip("this test checks the behaviour on platforms other than linux")
|
|
|
|
project_dir = tmp_path / "project"
|
|
project_with_a_test.generate(project_dir)
|
|
|
|
# build and test the wheels
|
|
with pytest.raises(subprocess.CalledProcessError):
|
|
utils.cibuildwheel_run(
|
|
project_dir,
|
|
add_env={
|
|
"CIBW_ARCHS": "aarch64",
|
|
},
|
|
)
|
|
|
|
captured = capfd.readouterr()
|
|
assert "Invalid archs option" in captured.err
|