Skip to content

Commit

Permalink
Add test to avoid invalidating virtualenv (#1031)
Browse files Browse the repository at this point in the history
## Summary

I think if we used symlinks (instead of hardlinks), this test would fail
-- so it's worth including.
  • Loading branch information
charliermarsh authored Jan 22, 2024
1 parent 540442b commit 23f7359
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion crates/puffin/tests/pip_sync.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(all(feature = "python", feature = "pypi"))]

use std::iter;
use std::path::Path;
use std::process::Command;
use std::{fs, iter};

use anyhow::{Context, Result};
use assert_cmd::prelude::*;
Expand Down Expand Up @@ -121,6 +121,11 @@ fn install() -> Result<()> {

check_command(&venv, "import markupsafe", &temp_dir);

// Removing the cache shouldn't invalidate the virtual environment.
fs::remove_dir_all(cache_dir.path())?;

check_command(&venv, "import markupsafe", &temp_dir);

Ok(())
}

Expand Down Expand Up @@ -163,6 +168,11 @@ fn install_copy() -> Result<()> {

check_command(&venv, "import markupsafe", &temp_dir);

// Removing the cache shouldn't invalidate the virtual environment.
fs::remove_dir_all(cache_dir.path())?;

check_command(&venv, "import markupsafe", &temp_dir);

Ok(())
}

Expand Down Expand Up @@ -205,6 +215,11 @@ fn install_hardlink() -> Result<()> {

check_command(&venv, "import markupsafe", &temp_dir);

// Removing the cache shouldn't invalidate the virtual environment.
fs::remove_dir_all(cache_dir.path())?;

check_command(&venv, "import markupsafe", &temp_dir);

Ok(())
}

Expand Down

0 comments on commit 23f7359

Please sign in to comment.