Skip to content

Commit 39f515e

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

File tree

2 files changed

+52
-17
lines changed

2 files changed

+52
-17
lines changed

cibuildwheel/platforms/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def setup_env(
227227

228228
# Install build tools
229229
if build_frontend not in {"build", "build[uv]"}:
230-
msg = "Android requires the build frontend to be 'build'"
230+
msg = f"Android requires the build frontend to be 'build' or 'build[uv'], not {build_frontend!r}"
231231
raise errors.FatalError(msg)
232232
call(*pip, "install", "build", *constraint_flags(dependency_constraint), env=build_env)
233233

test/conftest.py

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,29 +151,64 @@ def docker_warmup_fixture(
151151
return None
152152

153153

154-
@pytest.fixture(params=["pip", "build"])
154+
PLATFORM = get_platform()
155+
UV_PATH = find_uv()
156+
157+
BUILD_FRONTEND_PARAMS = [
158+
pytest.param(
159+
"build[uv]",
160+
marks=[
161+
pytest.mark.skipif(
162+
PLATFORM == "pyodide",
163+
reason="Can't use uv with pyodide yet",
164+
),
165+
pytest.mark.skipif(
166+
UV_PATH is None,
167+
reason="Can't find uv, so skipping uv tests",
168+
),
169+
],
170+
id="build[uv]",
171+
),
172+
pytest.param(
173+
"build",
174+
marks=pytest.mark.skipif(
175+
UV_PATH is not None and PLATFORM not in {"android", "ios"},
176+
reason="No need to check build when build[uv] is checked (faster)",
177+
),
178+
id="build",
179+
),
180+
pytest.param(
181+
"pip",
182+
marks=pytest.mark.skipif(
183+
PLATFORM in {"pyodide", "ios", "android"},
184+
reason=f"Can't use pip as build frontend for {PLATFORM}",
185+
),
186+
id="pip",
187+
),
188+
]
189+
190+
191+
@pytest.fixture(
192+
params=[
193+
pytest.param(
194+
"pip",
195+
marks=pytest.mark.skipif(
196+
PLATFORM in {"pyodide", "ios", "android"},
197+
reason=f"Can't use pip as build frontend for {PLATFORM}",
198+
),
199+
),
200+
"build",
201+
]
202+
)
155203
def build_frontend_env_nouv(request: pytest.FixtureRequest) -> dict[str, str]:
156204
frontend = request.param
157-
if get_platform() == "pyodide" and frontend == "pip":
158-
pytest.skip("Can't use pip as build frontend for pyodide platform")
159-
160205
return {"CIBW_BUILD_FRONTEND": frontend}
161206

162207

163-
@pytest.fixture(params=["pip", "build", "build[uv]"])
208+
@pytest.fixture(params=BUILD_FRONTEND_PARAMS)
164209
def build_frontend_env(request: pytest.FixtureRequest) -> dict[str, str]:
210+
print(f{"{PLATFORM=}")
165211
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")
176-
177212
return {"CIBW_BUILD_FRONTEND": frontend}
178213

179214

0 commit comments

Comments
 (0)