mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-28 21:14:47 +00:00
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:
parent
540442b8de
commit
23f73592b1
1 changed files with 16 additions and 1 deletions
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue