Skip to content

Commit

Permalink
Fix tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jan 18, 2019
1 parent 7d09992 commit 60a0a12
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
10 changes: 10 additions & 0 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ pub fn check_installed(package: &Path, python: &PathBuf) -> Result<(), ()> {

Ok(())
}

pub fn install_cffi(python: &PathBuf) {
let output = Command::new(&python)
.args(&["-m", "pip", "install", "cffi"])
.output()
.unwrap();
if !output.status.success() {
panic!(output.status);
}
}
13 changes: 4 additions & 9 deletions tests/test_develop.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::common::check_installed;
use crate::common::install_cffi;
use pyo3_pack::{develop, Target};
use std::fs;
use std::path::Path;
Expand All @@ -8,7 +9,7 @@ use std::process::Stdio;
mod common;

#[test]
#[cfg(not(feature = "skip-pyo3-test"))]
#[cfg(not(target_os = "windows"))] // TODO: Virtualenv support is broken on windows
fn test_develop_get_fourtytwo() {
test_develop(Path::new("get-fourtytwo"), None);
}
Expand All @@ -23,7 +24,7 @@ fn test_develop_hello_world() {
test_develop(Path::new("hello-world"), Some("bin".to_string()));
}

/// Creates a virtualenv and activates it, checks that the package isn't installed, uses
/// Creates a virtual env and activates it, checks that the package isn't installed, uses
/// "pyo3-pack develop" to install it and checks it is working
fn test_develop(package: &Path, bindings: Option<String>) {
let venv_dir = package.join("venv_develop");
Expand All @@ -48,13 +49,7 @@ fn test_develop(package: &Path, bindings: Option<String>) {
// Ensure the test doesn't wrongly pass
check_installed(&package, &python).unwrap_err();

let output = Command::new(&python)
.args(&["-m", "pip", "install", "cffi"])
.output()
.unwrap();
if !output.status.success() {
panic!(output.status);
}
install_cffi(&python);

let manifest_file = package.join("Cargo.toml");
develop(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_integration.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::common::check_installed;
use crate::common::install_cffi;
use pyo3_pack::{BuildOptions, Target};
use std::path::Path;
use std::process::{Command, Stdio};
Expand Down Expand Up @@ -64,6 +65,7 @@ fn test_integration(package: &Path, bindings: Option<String>) {

let options = BuildOptions::from_iter_safe(cli).unwrap();

install_cffi(&target.get_python());
let wheels = options
.into_build_context(false, false)
.unwrap()
Expand Down

0 comments on commit 60a0a12

Please sign in to comment.