Files

44 lines
1.3 KiB
Python
Raw Permalink Normal View History

2026-05-28 00:20:08 +02:00
from __future__ import annotations
2020-05-02 22:50:52 +01:00
import textwrap
2021-01-06 13:50:58 -05:00
from . import test_projects, utils
2020-05-02 16:54:19 +01:00
2026-05-28 00:20:08 +02:00
TYPE_CHECKING = False
if TYPE_CHECKING:
from pathlib import Path
project_with_skip_asserts = test_projects.new_c_project(
2021-04-30 17:56:34 -04:00
setup_py_add=textwrap.dedent(
2024-05-26 12:41:20 +02:00
rf"""
2021-02-14 20:44:20 +01:00
if sys.implementation.name != "cpython":
raise Exception("Only CPython shall be built")
2024-05-26 12:41:20 +02:00
expected_version = {"({}, {})".format(*utils.SINGLE_PYTHON_VERSION)}
if sys.version_info[0:2] != expected_version:
raise Exception("CPython {{}}.{{}} should be skipped".format(*sys.version_info[0:2]))
2021-05-03 11:45:43 -04:00
"""
2021-04-30 17:56:34 -04:00
)
2020-05-02 16:54:19 +01:00
)
2020-05-02 22:50:52 +01:00
2026-04-01 10:23:02 -04:00
def test(tmp_path: Path) -> None:
2021-05-03 11:45:43 -04:00
project_dir = tmp_path / "project"
2020-05-02 16:54:19 +01:00
project_with_skip_asserts.generate(project_dir)
2024-05-26 12:41:20 +02:00
skip = " ".join(
f"cp3{minor}-*" for minor in range(6, 30) if (3, minor) != utils.SINGLE_PYTHON_VERSION
)
2020-05-02 16:54:19 +01:00
# build the wheels
2021-04-30 17:56:34 -04:00
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_BUILD": "cp3*-*",
2024-05-26 12:41:20 +02:00
"CIBW_SKIP": f"*t-* {skip}",
2021-04-30 17:56:34 -04:00
},
)
2020-05-02 16:54:19 +01:00
2024-05-26 12:41:20 +02:00
# check that we got the right wheels. There should be a single version of CPython.
expected_wheels = utils.expected_wheels("spam", "0.1.0", single_python=True)
2020-05-02 16:54:19 +01:00
assert set(actual_wheels) == set(expected_wheels)