Skip to content

Commit e4e958d

Browse files
committed
fix: use uv in test environment too
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 97d43f1 commit e4e958d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cibuildwheel/platforms/android.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def build(options: Options, tmp_path: Path) -> None:
147147
built_wheel = build_wheel(state)
148148
repaired_wheel = repair_wheel(state, built_wheel)
149149

150-
test_wheel(state, repaired_wheel)
150+
test_wheel(state, repaired_wheel, build_frontend=build_options.build_frontend.name)
151151

152152
output_wheel: Path | None = None
153153
if compatible_wheel is None:
@@ -565,12 +565,19 @@ def soname_with_hash(src_path: Path) -> str:
565565
return src_name
566566

567567

568-
def test_wheel(state: BuildState, wheel: Path) -> None:
568+
def test_wheel(state: BuildState, wheel: Path, *, build_frontend: str) -> None:
569569
test_command = state.options.test_command
570570
if not (test_command and state.options.test_selector(state.config.identifier)):
571571
return
572572

573573
log.step("Testing wheel...")
574+
use_uv = build_frontend == "build[uv]"
575+
uv_path = find_uv()
576+
if use_uv and uv_path is None:
577+
msg = "uv not found"
578+
raise AssertionError(msg)
579+
pip = ["pip"] if not use_uv else [str(uv_path), "pip"]
580+
574581
native_arch = arch_synonym(platform.machine(), platforms.native_platform(), "android")
575582
if state.config.arch != native_arch:
576583
log.warning(
@@ -590,7 +597,7 @@ def test_wheel(state: BuildState, wheel: Path) -> None:
590597
site_packages_dir = state.build_path / "site-packages"
591598
site_packages_dir.mkdir()
592599
call(
593-
"pip",
600+
*pip,
594601
"install",
595602
"--only-binary=:all:",
596603
"--platform",

test/test_android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_frontend_good(tmp_path, build_frontend_env):
107107
new_c_project().generate(tmp_path)
108108
wheels = cibuildwheel_run(
109109
tmp_path,
110-
add_env={**cp313_env, **build_frontend_env},
110+
add_env={**cp313_env, **build_frontend_env, "CIBW_TEST_COMMAND": "python -m site"},
111111
)
112112
assert wheels == [f"spam-0.1.0-cp313-cp313-android_21_{native_arch.android_abi}.whl"]
113113

0 commit comments

Comments
 (0)