mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-08 05:45:00 +00:00
Isolate virtual environment tests from developer toolchains (#4342)
Otherwise, when testing `uv venv --preview` the default toolchain directory will leak into the test. I believe I've made a similar change for the standard `TestContext` in another commit somewhere in my stack, if not I'll add it after.
This commit is contained in:
parent
3a55c17ef1
commit
52bb9a694c
1 changed files with 6 additions and 0 deletions
|
@ -19,6 +19,7 @@ struct VenvTestContext {
|
|||
cache_dir: assert_fs::TempDir,
|
||||
temp_dir: assert_fs::TempDir,
|
||||
venv: ChildPath,
|
||||
toolchain_dir: ChildPath,
|
||||
python_path: OsString,
|
||||
python_versions: Vec<PythonVersion>,
|
||||
}
|
||||
|
@ -29,6 +30,9 @@ impl VenvTestContext {
|
|||
let python_path = python_path_with_versions(&temp_dir, python_versions)
|
||||
.expect("Failed to create Python test path");
|
||||
|
||||
let toolchain_dir = temp_dir.child("toolchains");
|
||||
toolchain_dir.create_dir_all().unwrap();
|
||||
|
||||
// Canonicalize the virtual environment path for consistent snapshots across platforms
|
||||
let venv = ChildPath::new(temp_dir.canonicalize().unwrap().join(".venv"));
|
||||
|
||||
|
@ -41,6 +45,7 @@ impl VenvTestContext {
|
|||
Self {
|
||||
cache_dir: assert_fs::TempDir::new().unwrap(),
|
||||
temp_dir,
|
||||
toolchain_dir,
|
||||
venv,
|
||||
python_path,
|
||||
python_versions,
|
||||
|
@ -55,6 +60,7 @@ impl VenvTestContext {
|
|||
.arg(self.cache_dir.path())
|
||||
.arg("--exclude-newer")
|
||||
.arg(EXCLUDE_NEWER)
|
||||
.env("UV_TOOLCHAIN_DIR", self.toolchain_dir.as_os_str())
|
||||
.env("UV_TEST_PYTHON_PATH", self.python_path.clone())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env("UV_STACK_SIZE", (2 * 1024 * 1024).to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue