Skip to content

Commit 19db6d4

Browse files
committed
Add successful test building with Py_LIMITED_API
1 parent 700974b commit 19db6d4

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

test/test_limited_api.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from . import test_projects, utils
2+
3+
basic_project = test_projects.new_c_project(
4+
setup_py_setup_args_add='py_limited_api=True',
5+
)
6+
7+
8+
def test_setup_py(tmp_path):
9+
project_dir = tmp_path / 'project'
10+
basic_project.generate(project_dir)
11+
12+
# build the wheels
13+
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
14+
'CIBW_BUILD': 'cp27-* cp35-*',
15+
})
16+
17+
# check that the expected wheels are produced
18+
expected_wheels = utils.expected_wheels('spam', '0.1.0', limited_api=True)
19+
assert set(actual_wheels) == set(expected_wheels)

test/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp
7777

7878
def expected_wheels(package_name, package_version, manylinux_versions=None,
7979
macosx_deployment_target='10.9', machine_arch=None, *,
80-
exclude_27=IS_WINDOWS_RUNNING_ON_TRAVIS):
80+
exclude_27=IS_WINDOWS_RUNNING_ON_TRAVIS,
81+
limited_api=False):
8182
'''
8283
Returns a list of expected wheels from a run of cibuildwheel.
8384
'''
@@ -95,7 +96,10 @@ def expected_wheels(package_name, package_version, manylinux_versions=None,
9596
else:
9697
manylinux_versions = ['manylinux2014']
9798

98-
python_abi_tags = ['cp35-cp35m', 'cp36-cp36m', 'cp37-cp37m', 'cp38-cp38', 'cp39-cp39']
99+
if limited_api:
100+
python_abi_tags = ['cp35-abi3']
101+
else:
102+
python_abi_tags = ['cp35-cp35m', 'cp36-cp36m', 'cp37-cp37m', 'cp38-cp38', 'cp39-cp39']
99103

100104
if machine_arch in ['x86_64', 'AMD64', 'x86']:
101105
python_abi_tags += ['cp27-cp27m', 'pp27-pypy_73', 'pp36-pypy36_pp73', 'pp37-pypy37_pp73']

0 commit comments

Comments
 (0)