chore: rework single python tests (#1835)
* chore: rework single python tests * chore(tests): limit number of builds in test_abi3 * chore(tests): limit number of builds in test_before_all * apply review suggestion use `os.path.samefile` rather than comparing `os.stat` directly.
This commit is contained in:
+11
-9
@@ -6,12 +6,12 @@ from . import test_projects, utils
|
||||
|
||||
project_with_skip_asserts = test_projects.new_c_project(
|
||||
setup_py_add=textwrap.dedent(
|
||||
r"""
|
||||
# explode if run on PyPyor Python 3.7 (these should be skipped)
|
||||
rf"""
|
||||
if sys.implementation.name != "cpython":
|
||||
raise Exception("Only CPython shall be built")
|
||||
if sys.version_info[0:2] == (3, 7):
|
||||
raise Exception("CPython 3.7 should be skipped")
|
||||
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]))
|
||||
"""
|
||||
)
|
||||
)
|
||||
@@ -21,17 +21,19 @@ def test(tmp_path):
|
||||
project_dir = tmp_path / "project"
|
||||
project_with_skip_asserts.generate(project_dir)
|
||||
|
||||
skip = " ".join(
|
||||
f"cp3{minor}-*" for minor in range(6, 30) if (3, minor) != utils.SINGLE_PYTHON_VERSION
|
||||
)
|
||||
|
||||
# build the wheels
|
||||
actual_wheels = utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_env={
|
||||
"CIBW_BUILD": "cp3*-*",
|
||||
"CIBW_SKIP": "cp37-*",
|
||||
"CIBW_SKIP": f"*t-* {skip}",
|
||||
},
|
||||
)
|
||||
|
||||
# check that we got the right wheels. There should be no PyPy or 3.7.
|
||||
expected_wheels = [
|
||||
w for w in utils.expected_wheels("spam", "0.1.0") if ("-cp3" in w) and ("-cp37" not in w)
|
||||
]
|
||||
# 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)
|
||||
assert set(actual_wheels) == set(expected_wheels)
|
||||
|
||||
Reference in New Issue
Block a user