Skip to content

Commit

Permalink
Remove filter for venv in working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jun 18, 2024
1 parent 10b13f0 commit fd6cfc5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 41 deletions.
12 changes: 3 additions & 9 deletions crates/uv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ impl TestContext {
pub fn new_with_versions(python_versions: &[&str]) -> Self {
let temp_dir = assert_fs::TempDir::new().expect("Failed to create temp dir");
let cache_dir = assert_fs::TempDir::new().expect("Failed to create cache dir");
let canonical_temp_dir = temp_dir.canonicalize().unwrap();
let venv = ChildPath::new(canonical_temp_dir.join(".venv"));

let venv = temp_dir.child(".venv");
let python_version = python_versions
.first()
.map(|version| PythonVersion::from_str(version).unwrap());
Expand Down Expand Up @@ -177,19 +178,12 @@ impl TestContext {
filters.push((
Self::path_pattern(
site_packages
.strip_prefix(&temp_dir)
.strip_prefix(&canonical_temp_dir)
.expect("The test site-packages directory is always in the tempdir"),
),
"[SITE_PACKAGES]/".to_string(),
));
};
filters.push((
Self::path_pattern(
venv.strip_prefix(&temp_dir)
.expect("The test virtual environment directory is always in the tempdir"),
),
"[VENV]/".to_string(),
));

// Filter non-deterministic temporary directory names
// Note we apply this _after_ all the full paths to avoid breaking their matching
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,7 @@ fn lock_requires_python() -> Result<()> {
----- stderr -----
warning: `uv sync` is experimental and may change without warning.
Removing virtual environment at: [VENV]/
Removing virtual environment at: .venv
error: No interpreter found for Python >=3.12 in provided path, active virtual environment, or search path
"###);

Expand Down
6 changes: 3 additions & 3 deletions crates/uv/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn run_with_python_version() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
Resolved 5 packages in [TIME]
Downloaded 4 packages in [TIME]
Installed 4 packages in [TIME]
Expand Down Expand Up @@ -102,9 +102,9 @@ fn run_with_python_version() -> Result<()> {
3.6.0
----- stderr -----
Removing virtual environment at: [VENV]/
Removing virtual environment at: .venv
Using Python 3.11.[X] interpreter at: [PYTHON-3.11]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
Resolved 5 packages in [TIME]
Downloaded 4 packages in [TIME]
Installed 4 packages in [TIME]
Expand Down
52 changes: 26 additions & 26 deletions crates/uv/tests/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ fn create_venv() {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -41,8 +41,8 @@ fn create_venv() {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -61,8 +61,8 @@ fn create_venv_defaults_to_cwd() {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -82,8 +82,8 @@ fn create_venv_ignores_virtual_env_variable() {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);
}
Expand All @@ -102,9 +102,9 @@ fn seed() {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
+ pip==24.0
Activate with: source [VENV]/bin/activate
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -125,11 +125,11 @@ fn seed_older_python_version() {
----- stderr -----
Using Python 3.10.[X] interpreter at: [PYTHON-3.10]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
+ pip==24.0
+ setuptools==69.2.0
+ wheel==0.43.0
Activate with: source [VENV]/bin/activate
Activate with: source .venv/bin/activate
"###
);

Expand Down Expand Up @@ -252,11 +252,11 @@ fn file_exists() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
uv::venv::creation
× Failed to create virtualenv
╰─▶ File exists at `[VENV]/`
╰─▶ File exists at `.venv`
"###
);

Expand All @@ -279,8 +279,8 @@ fn empty_dir_exists() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -307,11 +307,11 @@ fn non_empty_dir_exists() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
uv::venv::creation
× Failed to create virtualenv
╰─▶ The directory `[VENV]/` exists, but it's not a virtualenv
╰─▶ The directory `.venv` exists, but it's not a virtualenv
"###
);

Expand All @@ -337,11 +337,11 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
uv::venv::creation
× Failed to create virtualenv
╰─▶ The directory `[VENV]/` exists, but it's not a virtualenv
╰─▶ The directory `.venv` exists, but it's not a virtualenv
"###
);

Expand All @@ -356,8 +356,8 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand All @@ -374,8 +374,8 @@ fn non_empty_dir_exists_allow_existing() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand Down Expand Up @@ -443,8 +443,8 @@ fn virtualenv_compatibility() {
----- stderr -----
warning: virtualenv's `--clear` has no effect (uv always clears the virtual environment).
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtualenv at: [VENV]/
Activate with: source [VENV]/bin/activate
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
"###
);

Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
Resolved 8 packages in [TIME]
Downloaded 5 packages in [TIME]
Installed 5 packages in [TIME]
Expand Down Expand Up @@ -479,7 +479,7 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
----- stderr -----
Using Python 3.12.[X] interpreter at: [PYTHON]
Creating virtualenv at: [VENV]/
Creating virtualenv at: .venv
Resolved 8 packages in [TIME]
Downloaded 5 packages in [TIME]
Installed 5 packages in [TIME]
Expand Down

0 comments on commit fd6cfc5

Please sign in to comment.