Skip to content

Commit 5969e1d

Browse files
committed
tests: rework skips to show uv vs. build
Signed-off-by: Henry Schreiner <[email protected]>
1 parent d139d8a commit 5969e1d

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

test/conftest.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,21 @@ def build_frontend_env_nouv(request: pytest.FixtureRequest) -> dict[str, str]:
160160
return {"CIBW_BUILD_FRONTEND": frontend}
161161

162162

163-
@pytest.fixture
164-
def build_frontend_env(build_frontend_env_nouv: dict[str, str]) -> dict[str, str]:
165-
frontend = build_frontend_env_nouv["CIBW_BUILD_FRONTEND"]
166-
if frontend != "build" or get_platform() == "pyodide" or find_uv() is None:
167-
return build_frontend_env_nouv
163+
@pytest.fixture(params=["pip", "build", "build[uv]"])
164+
def build_frontend_env(request: pytest.FixtureRequest) -> dict[str, str]:
165+
frontend = request.param
166+
platform = get_platform()
167+
if platform in {"pyodide", "ios", "android"} and frontend == "pip":
168+
pytest.skip("Can't use pip as build frontend for pyodide/ios/android platform")
169+
if platform == "pyodide" and frontend == "build[uv]":
170+
pytest.skip("Can't use uv with pyodide yet")
171+
uv_path = find_uv()
172+
if uv_path is None and frontend == "build[uv]":
173+
pytest.skip("Can't find uv, so skipping uv tests")
174+
if uv_path is not None and frontend == "build" and platform not in {"android", "ios"}:
175+
pytest.skip("No need to check build when uv is present")
168176

169-
return {"CIBW_BUILD_FRONTEND": "build[uv]"}
177+
return {"CIBW_BUILD_FRONTEND": frontend}
170178

171179

172180
@pytest.fixture

test/test_android.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,11 @@ def test_expected_wheels(tmp_path):
103103
)
104104

105105

106-
@pytest.mark.parametrize("frontend", ["build[uv]", "pip"])
107-
def test_frontend_good(tmp_path, frontend):
106+
def test_frontend_good(tmp_path, build_frontend_env):
108107
new_c_project().generate(tmp_path)
109108
wheels = cibuildwheel_run(
110109
tmp_path,
111-
add_env={**cp313_env, "CIBW_BUILD_FRONTEND": frontend},
110+
add_env={**cp313_env, **build_frontend_env},
112111
)
113112
assert wheels == [f"spam-0.1.0-cp313-cp313-android_21_{native_arch.android_abi}.whl"]
114113

0 commit comments

Comments
 (0)