Files
cibuildwheel/test/test_pep518.py
T

61 lines
1.7 KiB
Python
Raw Normal View History

2021-01-06 13:50:58 -05:00
import textwrap
from . import test_projects, utils
2020-05-29 17:24:01 -04:00
basic_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
"""
# Will fail if PEP 518 does work
import requests
2021-02-14 20:44:20 +01:00
assert requests.__version__ == "2.23.0", "Requests found but wrong version ({0})".format(requests.__version__)
2020-05-29 17:24:01 -04:00
# Just making sure environment is still set
import os
if os.environ.get("CIBUILDWHEEL", "0") != "1":
raise Exception("CIBUILDWHEEL environment variable is not set to 1")
"""
)
)
basic_project.files[
"pyproject.toml"
] = """
[build-system]
requires = [
2020-07-08 20:12:50 +01:00
"setuptools >= 42",
2020-08-13 20:50:36 -04:00
"setuptools_scm[toml]>=4.1.2",
2020-05-29 17:24:01 -04:00
"wheel",
2021-02-14 20:44:20 +01:00
"requests==2.23.0"
2020-05-29 17:24:01 -04:00
]
build-backend = "setuptools.build_meta"
"""
2021-06-23 10:47:18 -04:00
def test_pep518(tmp_path, build_frontend_env):
2020-05-29 17:24:01 -04:00
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
# build the wheels
2021-06-23 10:47:18 -04:00
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=build_frontend_env)
2020-05-29 17:24:01 -04:00
# check that the expected wheels are produced
expected_wheels = utils.expected_wheels("spam", "0.1.0")
assert set(actual_wheels) == set(expected_wheels)
2020-08-13 20:50:36 -04:00
2020-08-16 14:05:39 -04:00
# These checks ensure an extra file is not created when using custom
# workaround; see https://github.com/pypa/cibuildwheel/issues/421
2020-08-13 20:50:36 -04:00
assert not (project_dir / "42").exists()
assert not (project_dir / "4.1.2").exists()
2020-08-14 14:55:08 -04:00
2021-06-23 10:47:18 -04:00
# pypa/build creates a "build" folder & a "*.egg-info" folder for the wheel being built,
# this should be harmless so remove them
contents = [
item
for item in project_dir.iterdir()
if item.name != "build" and not item.name.endswith(".egg-info")
]
assert len(contents) == len(basic_project.files)