Skip to content

Commit

Permalink
Only run uv tests on platforms that has wheel on PyPI or when uv bina…
Browse files Browse the repository at this point in the history
…ry is found (#2037)
  • Loading branch information
messense authored Apr 10, 2024
1 parent d5ea484 commit aba8993
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
26 changes: 16 additions & 10 deletions tests/common/develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@ pub fn test_develop(
// Ensure the test doesn't wrongly pass
check_installed(package, &python).unwrap_err();

let output = Command::new(&python)
.args([
"-m",
"pip",
"install",
"--disable-pip-version-check",
"uv",
"cffi",
])
.output()?;
let mut cmd = Command::new(&python);
cmd.args([
"-m",
"pip",
"install",
"--disable-pip-version-check",
"cffi",
]);
if cfg!(any(
target_os = "linux",
target_os = "macos",
target_os = "windows"
)) {
cmd.arg("uv");
}
let output = cmd.output()?;
if !output.status.success() {
panic!(
"Failed to install cffi: {}\n---stdout:\n{}---stderr:\n{}",
Expand Down
24 changes: 24 additions & 0 deletions tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ fn develop_uniffi_mixed() {
#[case(TestInstallBackend::Uv, "uv")]
#[test]
fn develop_hello_world(#[case] backend: TestInstallBackend, #[case] name: &str) {
// Only run uv tests on platforms that has wheel on PyPI or when uv binary is found
if matches!(backend, TestInstallBackend::Uv)
&& !cfg!(any(
target_os = "linux",
target_os = "macos",
target_os = "windows"
))
&& which("uv").is_err()
{
return;
}

handle_result(develop::test_develop(
"test-crates/hello-world",
None,
Expand All @@ -205,6 +217,18 @@ fn develop_hello_world(#[case] backend: TestInstallBackend, #[case] name: &str)
#[case(TestInstallBackend::Uv, "uv")]
#[test]
fn develop_pyo3_ffi_pure(#[case] backend: TestInstallBackend, #[case] name: &str) {
// Only run uv tests on platforms that has wheel on PyPI or when uv binary is found
if matches!(backend, TestInstallBackend::Uv)
&& !cfg!(any(
target_os = "linux",
target_os = "macos",
target_os = "windows"
))
&& which("uv").is_err()
{
return;
}

handle_result(develop::test_develop(
"test-crates/pyo3-ffi-pure",
None,
Expand Down

0 comments on commit aba8993

Please sign in to comment.