Skip to content

Commit

Permalink
Do not delete cffi-provider venv
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Nov 25, 2024
1 parent 75c0060 commit 67e8421
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion tests/common/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ pub fn test_integration(
let file = File::create(venvs_dir.join("cffi-provider.lock"))?;
file.lock_exclusive()?;
if !python.is_file() {
create_named_virtualenv(cffi_provider, python_interp.clone().map(PathBuf::from))?;
create_named_virtualenv(
cffi_provider,
python_interp.clone().map(PathBuf::from),
false,
)?;
let pip_install_cffi = [
"-m",
"pip",
Expand Down
11 changes: 7 additions & 4 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,24 @@ pub fn create_virtualenv(name: &str, python_interp: Option<PathBuf>) -> Result<(
Err(_) => name.to_string(),
};

let venv_dir = create_named_virtualenv(&venv_name, interp)?;

let venv_dir = create_named_virtualenv(&venv_name, interp, true)?;
let target = Target::from_target_triple(None)?;
let python = target.get_venv_python(&venv_dir);
Ok((venv_dir, python))
}

pub fn create_named_virtualenv(venv_name: &str, interp: Option<PathBuf>) -> Result<PathBuf> {
pub fn create_named_virtualenv(
venv_name: &str,
interp: Option<PathBuf>,
clear: bool,
) -> Result<PathBuf> {
let venv_dir = PathBuf::from("test-crates")
.normalize()?
.into_path_buf()
.join("venvs")
.join(venv_name);

if venv_dir.is_dir() {
if clear && venv_dir.is_dir() {
fs::remove_dir_all(&venv_dir)?;
}

Expand Down

0 comments on commit 67e8421

Please sign in to comment.