Add test to avoid invalidating virtualenv (#1031)

## Summary

I think if we used symlinks (instead of hardlinks), this test would fail
-- so it's worth including.
This commit is contained in:
Charlie Marsh 2024-01-21 19:53:58 -05:00 committed by GitHub
parent 540442b8de
commit 23f73592b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,8 +1,8 @@
#![cfg(all(feature = "python", feature = "pypi"))] #![cfg(all(feature = "python", feature = "pypi"))]
use std::iter;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::{fs, iter};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use assert_cmd::prelude::*; use assert_cmd::prelude::*;
@ -121,6 +121,11 @@ fn install() -> Result<()> {
check_command(&venv, "import markupsafe", &temp_dir); 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(()) Ok(())
} }
@ -163,6 +168,11 @@ fn install_copy() -> Result<()> {
check_command(&venv, "import markupsafe", &temp_dir); 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(()) Ok(())
} }
@ -205,6 +215,11 @@ fn install_hardlink() -> Result<()> {
check_command(&venv, "import markupsafe", &temp_dir); 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(()) Ok(())
} }