Skip to content

Commit

Permalink
Merge pull request #1885 from messense/skip-pypy-on-windows
Browse files Browse the repository at this point in the history
Skip PyPy tests on Windows for now
  • Loading branch information
messense authored Dec 17, 2023
2 parents 506481c + fe5007b commit 32ce139
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ jobs:
- name: Install build requirements
run: |
set -ex
apk add cargo python3-dev libffi-dev py3-pip curl bash tar zstd git patchelf
pip3 install cffi virtualenv
apk add cargo python3-dev libffi-dev py3-pip curl \
bash tar zstd git patchelf py3-cffi py3-virtualenv
- uses: actions/checkout@v4
- name: Fix git permissions
run: git config --global --add safe.directory $GITHUB_WORKSPACE
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
manylinux: ["manylinux_2_24"]
container: quay.io/pypa/${{ matrix.manylinux }}_x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
id: rustup
# Caching
Expand Down
9 changes: 9 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ pub fn get_python_implementation(python_interp: &Path) -> Result<String> {
Ok(python_impl)
}

/// Get the current tested Python implementation
pub fn test_python_implementation() -> Result<String> {
let python = test_python_path().map(PathBuf::from).unwrap_or_else(|| {
let target = Target::from_target_triple(None).unwrap();
target.get_python()
});
get_python_implementation(&python)
}

/// Create virtualenv
pub fn create_virtualenv(name: &str, python_interp: Option<PathBuf>) -> Result<(PathBuf, PathBuf)> {
let interp = python_interp.or_else(|| test_python_path().map(PathBuf::from));
Expand Down
45 changes: 25 additions & 20 deletions tests/run.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
//! To speed up the tests, they are tests all collected in a single module

use common::{
develop, errors, get_python_implementation, handle_result, integration, other, test_python_path,
};
use common::{develop, errors, handle_result, integration, other, test_python_implementation};
use expect_test::expect;
use maturin::pyproject_toml::SdistGenerator;
use maturin::Target;
use std::env;
use std::path::{Path, PathBuf};
use std::path::Path;
use time::macros::datetime;
use which::which;

Expand Down Expand Up @@ -99,6 +96,11 @@ fn develop_pyo3_mixed_src_layout() {

#[test]
fn develop_cffi_pure() {
let python_implementation = test_python_implementation().unwrap();
if cfg!(windows) && env::var("GITHUB_ACTIONS").is_ok() && python_implementation == "pypy" {
// PyPy on Windows hangs on cffi test sometimes
return;
}
handle_result(develop::test_develop(
"test-crates/cffi-pure",
None,
Expand All @@ -109,6 +111,11 @@ fn develop_cffi_pure() {

#[test]
fn develop_cffi_mixed() {
let python_implementation = test_python_implementation().unwrap();
if cfg!(windows) && env::var("GITHUB_ACTIONS").is_ok() && python_implementation == "pypy" {
// PyPy on Windows hangs on cffi test sometimes
return;
}
handle_result(develop::test_develop(
"test-crates/cffi-mixed",
None,
Expand Down Expand Up @@ -173,11 +180,7 @@ fn develop_pyo3_ffi_pure() {

#[test]
fn integration_pyo3_bin() {
let python = test_python_path().map(PathBuf::from).unwrap_or_else(|| {
let target = Target::from_target_triple(None).unwrap();
target.get_python()
});
let python_implementation = get_python_implementation(&python).unwrap();
let python_implementation = test_python_implementation().unwrap();
if python_implementation == "pypy" || python_implementation == "graalpy" {
// PyPy & GraalPy do not support the 'auto-initialize' feature of pyo3
return;
Expand Down Expand Up @@ -283,6 +286,11 @@ fn integration_pyo3_pure_conda() {

#[test]
fn integration_cffi_pure() {
let python_implementation = test_python_implementation().unwrap();
if cfg!(windows) && env::var("GITHUB_ACTIONS").is_ok() && python_implementation == "pypy" {
// PyPy on Windows hangs on cffi test sometimes
return;
}
handle_result(integration::test_integration(
"test-crates/cffi-pure",
None,
Expand All @@ -294,6 +302,11 @@ fn integration_cffi_pure() {

#[test]
fn integration_cffi_mixed() {
let python_implementation = test_python_implementation().unwrap();
if cfg!(windows) && env::var("GITHUB_ACTIONS").is_ok() && python_implementation == "pypy" {
// PyPy on Windows hangs on cffi test sometimes
return;
}
handle_result(integration::test_integration(
"test-crates/cffi-mixed",
None,
Expand Down Expand Up @@ -399,11 +412,7 @@ fn integration_wasm_hello_world() {
Some("wasm32-wasi"),
));

let python = test_python_path().map(PathBuf::from).unwrap_or_else(|| {
let target = Target::from_target_triple(None).unwrap();
target.get_python()
});
let python_implementation = get_python_implementation(&python).unwrap();
let python_implementation = test_python_implementation().unwrap();
let venv_name = format!("integration-wasm-hello-world-py3-wasm32-wasi-{python_implementation}");

// Make sure we're actually running wasm
Expand Down Expand Up @@ -443,11 +452,7 @@ fn abi3_without_version() {
ignore
)]
fn pyo3_no_extension_module() {
let python = test_python_path().map(PathBuf::from).unwrap_or_else(|| {
let target = Target::from_target_triple(None).unwrap();
target.get_python()
});
let python_implementation = get_python_implementation(&python).unwrap();
let python_implementation = test_python_implementation().unwrap();
if python_implementation == "cpython" {
handle_result(errors::pyo3_no_extension_module())
}
Expand Down

0 comments on commit 32ce139

Please sign in to comment.