Skip to content

Commit

Permalink
Add py_limited_api to setup.cfg in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickJadoul committed Jan 31, 2021
1 parent 19db6d4 commit cd5d185
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions test/test_limited_api.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import textwrap

from . import test_projects, utils

basic_project = test_projects.new_c_project(
setup_py_setup_args_add='py_limited_api=True',
setup_cfg_add=textwrap.dedent(r'''
[bdist_wheel]
py_limited_api=cp36
''')
)


def test_setup_py(tmp_path):
def test_setup_cfg(tmp_path):
project_dir = tmp_path / 'project'
basic_project.generate(project_dir)

# build the wheels
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
'CIBW_BUILD': 'cp27-* cp35-*',
'CIBW_BUILD': 'cp27-* cp36-*',
})

# check that the expected wheels are produced
expected_wheels = utils.expected_wheels('spam', '0.1.0', limited_api=True)
expected_wheels = utils.expected_wheels('spam', '0.1.0', limited_api='cp36')
assert set(actual_wheels) == set(expected_wheels)
4 changes: 2 additions & 2 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp
def expected_wheels(package_name, package_version, manylinux_versions=None,
macosx_deployment_target='10.9', machine_arch=None, *,
exclude_27=IS_WINDOWS_RUNNING_ON_TRAVIS,
limited_api=False):
limited_api=None):
'''
Returns a list of expected wheels from a run of cibuildwheel.
'''
Expand All @@ -97,7 +97,7 @@ def expected_wheels(package_name, package_version, manylinux_versions=None,
manylinux_versions = ['manylinux2014']

if limited_api:
python_abi_tags = ['cp35-abi3']
python_abi_tags = [f'{limited_api}-abi3']
else:
python_abi_tags = ['cp35-cp35m', 'cp36-cp36m', 'cp37-cp37m', 'cp38-cp38', 'cp39-cp39']

Expand Down

0 comments on commit cd5d185

Please sign in to comment.