Use uv sync in workspace tests (#12181)

This commit is contained in:
Charlie Marsh 2025-03-15 13:52:43 -07:00 committed by GitHub
parent 5880a98163
commit 2a9bade4df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 323 additions and 307 deletions

View file

@ -1624,74 +1624,21 @@ mod tests {
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r###"
{
"project_root": "[ROOT]/albatross-in-example/examples/bird-feeder",
"project_name": "bird-feeder",
"workspace": {
"install_path": "[ROOT]/albatross-in-example/examples/bird-feeder",
"packages": {
"bird-feeder": {
"root": "[ROOT]/albatross-in-example/examples/bird-feeder",
"project": {
"name": "bird-feeder",
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"anyio>=4.3.0,<5"
],
"optional-dependencies": null
},
"pyproject_toml": "[PYPROJECT_TOML]"
}
},
"sources": {},
"indexes": [],
"pyproject_toml": {
"project": {
"name": "bird-feeder",
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"anyio>=4.3.0,<5"
],
"optional-dependencies": null
},
"tool": null,
"dependency-groups": null
}
}
}
"###);
});
}
#[tokio::test]
async fn albatross_project_in_excluded() {
let (project, root_escaped) =
workspace_test("albatross-project-in-excluded/excluded/bird-feeder").await;
let filters = vec![(root_escaped.as_str(), "[ROOT]")];
insta::with_settings!({filters => filters}, {
assert_json_snapshot!(
project,
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r###"
@r#"
{
"project_root": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"project_root": "[ROOT]/albatross-in-example/examples/bird-feeder",
"project_name": "bird-feeder",
"workspace": {
"install_path": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"install_path": "[ROOT]/albatross-in-example/examples/bird-feeder",
"packages": {
"bird-feeder": {
"root": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"root": "[ROOT]/albatross-in-example/examples/bird-feeder",
"project": {
"name": "bird-feeder",
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"anyio>=4.3.0,<5"
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
@ -1706,7 +1653,7 @@ mod tests {
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"anyio>=4.3.0,<5"
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
@ -1715,7 +1662,60 @@ mod tests {
}
}
}
"###);
"#);
});
}
#[tokio::test]
async fn albatross_project_in_excluded() {
let (project, root_escaped) =
workspace_test("albatross-project-in-excluded/excluded/bird-feeder").await;
let filters = vec![(root_escaped.as_str(), "[ROOT]")];
insta::with_settings!({filters => filters}, {
assert_json_snapshot!(
project,
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r#"
{
"project_root": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"project_name": "bird-feeder",
"workspace": {
"install_path": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"packages": {
"bird-feeder": {
"root": "[ROOT]/albatross-project-in-excluded/excluded/bird-feeder",
"project": {
"name": "bird-feeder",
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
"pyproject_toml": "[PYPROJECT_TOML]"
}
},
"sources": {},
"indexes": [],
"pyproject_toml": {
"project": {
"name": "bird-feeder",
"version": "1.0.0",
"requires-python": ">=3.12",
"dependencies": [
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
"tool": null,
"dependency-groups": null
}
}
}
"#);
});
}
@ -1729,7 +1729,7 @@ mod tests {
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r###"
@r#"
{
"project_root": "[ROOT]/albatross-root-workspace",
"project_name": "albatross",
@ -1744,7 +1744,7 @@ mod tests {
"requires-python": ">=3.12",
"dependencies": [
"bird-feeder",
"tqdm>=4,<5"
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
@ -1757,7 +1757,7 @@ mod tests {
"version": "1.0.0",
"requires-python": ">=3.8",
"dependencies": [
"anyio>=4.3.0,<5",
"iniconfig>=2,<3",
"seeds"
],
"optional-dependencies": null
@ -1795,7 +1795,7 @@ mod tests {
"requires-python": ">=3.12",
"dependencies": [
"bird-feeder",
"tqdm>=4,<5"
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
@ -1833,7 +1833,7 @@ mod tests {
}
}
}
"###);
"#);
});
}
@ -1848,7 +1848,7 @@ mod tests {
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r###"
@r#"
{
"project_root": "[ROOT]/albatross-virtual-workspace/packages/albatross",
"project_name": "albatross",
@ -1863,7 +1863,7 @@ mod tests {
"requires-python": ">=3.12",
"dependencies": [
"bird-feeder",
"tqdm>=4,<5"
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
@ -1927,7 +1927,7 @@ mod tests {
}
}
}
"###);
"#);
});
}
@ -1941,45 +1941,45 @@ mod tests {
{
".workspace.packages.*.pyproject_toml" => "[PYPROJECT_TOML]"
},
@r###"
{
"project_root": "[ROOT]/albatross-just-project",
"project_name": "albatross",
"workspace": {
"install_path": "[ROOT]/albatross-just-project",
"packages": {
"albatross": {
"root": "[ROOT]/albatross-just-project",
"project": {
"name": "albatross",
"version": "0.1.0",
"requires-python": ">=3.12",
"dependencies": [
"tqdm>=4,<5"
],
"optional-dependencies": null
@r#"
{
"project_root": "[ROOT]/albatross-just-project",
"project_name": "albatross",
"workspace": {
"install_path": "[ROOT]/albatross-just-project",
"packages": {
"albatross": {
"root": "[ROOT]/albatross-just-project",
"project": {
"name": "albatross",
"version": "0.1.0",
"requires-python": ">=3.12",
"dependencies": [
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
"pyproject_toml": "[PYPROJECT_TOML]"
}
},
"pyproject_toml": "[PYPROJECT_TOML]"
"sources": {},
"indexes": [],
"pyproject_toml": {
"project": {
"name": "albatross",
"version": "0.1.0",
"requires-python": ">=3.12",
"dependencies": [
"iniconfig>=2,<3"
],
"optional-dependencies": null
},
"tool": null,
"dependency-groups": null
}
}
},
"sources": {},
"indexes": [],
"pyproject_toml": {
"project": {
"name": "albatross",
"version": "0.1.0",
"requires-python": ">=3.12",
"dependencies": [
"tqdm>=4,<5"
],
"optional-dependencies": null
},
"tool": null,
"dependency-groups": null
}
}
}
"###);
"#);
});
}

View file

@ -61,7 +61,7 @@ pub const INSTA_FILTERS: &[(&str, &str)] = &[
(r"tv_sec: \d+", "tv_sec: [TIME]"),
(r"tv_nsec: \d+", "tv_nsec: [TIME]"),
// Rewrite Windows output to Unix output
(r"\\([\w\d]|\.\.)", "/$1"),
(r"\\([\w\d]|\.)", "/$1"),
(r"uv\.exe", "uv"),
// uv version display
(
@ -1417,11 +1417,16 @@ pub fn run_and_format_with_status<T: AsRef<str>>(
if removed_packages > 0 {
for i in 1..20 {
for verb in match windows_filters {
WindowsFilters::Platform => {
["Resolved", "Prepared", "Installed", "Uninstalled"].iter()
}
WindowsFilters::Platform => [
"Resolved",
"Prepared",
"Installed",
"Audited",
"Uninstalled",
]
.iter(),
WindowsFilters::Universal => {
["Prepared", "Installed", "Uninstalled"].iter()
["Prepared", "Installed", "Audited", "Uninstalled"].iter()
}
} {
snapshot = snapshot.replace(

View file

@ -1,7 +1,6 @@
use std::collections::BTreeMap;
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::path::PathBuf;
use anyhow::Result;
use assert_cmd::assert::OutputAssertExt;
@ -13,12 +12,6 @@ use serde::{Deserialize, Serialize};
use crate::common::{copy_dir_ignore, make_project, uv_snapshot, TestContext};
fn install_workspace(context: &TestContext, current_dir: &Path) -> Command {
let mut command = context.pip_install();
command.arg("-e").arg(current_dir);
command
}
fn workspaces_dir() -> PathBuf {
env::current_dir()
.unwrap()
@ -35,7 +28,6 @@ fn test_albatross_in_examples_bird_feeder() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace
@ -43,31 +35,32 @@ fn test_albatross_in_examples_bird_feeder() {
.join("examples")
.join("bird-feeder");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 4 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ anyio==4.3.0
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-in-example/examples/bird-feeder)
+ idna==3.6
+ sniffio==1.3.1
"###
+ iniconfig==2.0.0
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Resolved 2 packages in [TIME]
Audited 2 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
@ -78,34 +71,36 @@ fn test_albatross_in_examples() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace.join("albatross-in-example");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-in-example)
+ iniconfig==2.0.0
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-in-example)
+ tqdm==4.66.2
"###
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Audited 2 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
@ -116,34 +111,36 @@ fn test_albatross_just_project() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace.join("albatross-just-project");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-just-project)
+ iniconfig==2.0.0
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-just-project)
+ tqdm==4.66.2
"###
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Audited 2 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
@ -154,39 +151,57 @@ fn test_albatross_project_in_excluded() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace.join("albatross-project-in-excluded");
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-project-in-excluded)
+ iniconfig==2.0.0
"
);
let current_dir = workspace
.join("albatross-project-in-excluded")
.join("excluded")
.join("bird-feeder");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 4 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ anyio==4.3.0
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
Prepared 1 package in [TIME]
Installed 2 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-project-in-excluded/excluded/bird-feeder)
+ idna==3.6
+ sniffio==1.3.1
"###
+ iniconfig==2.0.0
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Resolved 2 packages in [TIME]
Audited 2 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
@ -195,17 +210,14 @@ fn test_albatross_project_in_excluded() {
.join("albatross-project-in-excluded")
.join("packages")
.join("seeds");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
success: true
exit_code: 0
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-project-in-excluded/packages/seeds)
"###
error: The project is marked as unmanaged: `[TEMP_DIR]/workspace/albatross-project-in-excluded/packages/seeds`
"
);
}
@ -214,39 +226,39 @@ fn test_albatross_root_workspace() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace.join("albatross-root-workspace");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 7 packages in [TIME]
Prepared 7 packages in [TIME]
Installed 7 packages in [TIME]
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 5 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace)
+ anyio==4.3.0
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
+ tqdm==4.66.2
"###
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Resolved 5 packages in [TIME]
Audited 5 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
@ -257,7 +269,6 @@ fn test_albatross_root_workspace_bird_feeder() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace
@ -265,32 +276,34 @@ fn test_albatross_root_workspace_bird_feeder() {
.join("packages")
.join("bird-feeder");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: [TEMP_DIR]/workspace/albatross-root-workspace/.venv
Resolved 5 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/seeds)
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 5 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
"###
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Audited 4 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
@ -301,7 +314,6 @@ fn test_albatross_root_workspace_albatross() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace
@ -309,32 +321,34 @@ fn test_albatross_root_workspace_albatross() {
.join("packages")
.join("bird-feeder");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: [TEMP_DIR]/workspace/albatross-root-workspace/.venv
Resolved 5 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/seeds)
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 5 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
"###
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Audited 4 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_albatross.py"));
@ -345,7 +359,6 @@ fn test_albatross_virtual_workspace() {
let context = TestContext::new("3.12");
let workspace = context.temp_dir.child("workspace");
// Copy into the temporary directory
copy_dir_ignore(workspaces_dir(), &workspace).unwrap();
let current_dir = workspace
@ -353,13 +366,15 @@ fn test_albatross_virtual_workspace() {
.join("packages")
.join("bird-feeder");
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 5 packages in [TIME]
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: [TEMP_DIR]/workspace/albatross-virtual-workspace/.venv
Resolved 7 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
@ -367,18 +382,19 @@ fn test_albatross_virtual_workspace() {
+ idna==3.6
+ seeds==1.0.0 (from file://[TEMP_DIR]/workspace/albatross-virtual-workspace/packages/seeds)
+ sniffio==1.3.1
"###
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
uv_snapshot!(context.filters(), install_workspace(&context, &current_dir), @r###"
uv_snapshot!(context.filters(), context.sync().current_dir(&current_dir), @r"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
"###
Resolved 7 packages in [TIME]
Audited 5 packages in [TIME]
"
);
context.assert_file(current_dir.join("check_installed_bird_feeder.py"));
@ -407,7 +423,7 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
.arg("--package")
.arg("bird-feeder")
.arg("packages/bird-feeder/check_installed_bird_feeder.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -417,7 +433,7 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 8 packages in [TIME]
Resolved 7 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
@ -425,15 +441,15 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
+ idna==3.6
+ seeds==1.0.0 (from file://[TEMP_DIR]/albatross-virtual-workspace/packages/seeds)
+ sniffio==1.3.1
"###
"
);
uv_snapshot!(context.filters(), universal_windows_filters=true, context
uv_snapshot!(context.filters(), context
.run()
.arg("--package")
.arg("albatross")
.arg("packages/albatross/check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -441,12 +457,12 @@ fn test_uv_run_with_package_virtual_workspace() -> Result<()> {
----- stderr -----
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Resolved 8 packages in [TIME]
Resolved 7 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/albatross-virtual-workspace/packages/albatross)
+ tqdm==4.66.2
"###
+ iniconfig==2.0.0
"
);
Ok(())
@ -464,10 +480,10 @@ fn test_uv_run_virtual_workspace_root() -> Result<()> {
&work_dir,
)?;
uv_snapshot!(context.filters(), universal_windows_filters=true, context
uv_snapshot!(context.filters(), context
.run()
.arg("packages/albatross/check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -477,17 +493,17 @@ fn test_uv_run_virtual_workspace_root() -> Result<()> {
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 8 packages in [TIME]
Resolved 7 packages in [TIME]
Prepared 7 packages in [TIME]
Installed 7 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/albatross-virtual-workspace/packages/albatross)
+ anyio==4.3.0
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/albatross-virtual-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/albatross-virtual-workspace/packages/seeds)
+ sniffio==1.3.1
+ tqdm==4.66.2
"###
"
);
Ok(())
@ -512,7 +528,7 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
.arg("--package")
.arg("bird-feeder")
.arg("packages/bird-feeder/check_installed_bird_feeder.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -522,23 +538,22 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 8 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
Resolved 5 packages in [TIME]
Prepared 4 packages in [TIME]
Installed 4 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
"###
"
);
uv_snapshot!(context.filters(), universal_windows_filters=true, context
uv_snapshot!(context.filters(), context
.run()
.arg("--package")
.arg("albatross")
.arg("check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -546,12 +561,11 @@ fn test_uv_run_with_package_root_workspace() -> Result<()> {
----- stderr -----
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Resolved 8 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
Resolved 5 packages in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/albatross-root-workspace)
+ tqdm==4.66.2
"###
"
);
Ok(())
@ -572,12 +586,12 @@ fn test_uv_run_isolate() -> Result<()> {
));
// Install the root package.
uv_snapshot!(context.filters(), universal_windows_filters=true, context
uv_snapshot!(context.filters(), context
.run()
.arg("--package")
.arg("albatross")
.arg("check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -587,17 +601,15 @@ fn test_uv_run_isolate() -> Result<()> {
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 8 packages in [TIME]
Prepared 7 packages in [TIME]
Installed 7 packages in [TIME]
Resolved 5 packages in [TIME]
Prepared 5 packages in [TIME]
Installed 5 packages in [TIME]
+ albatross==0.1.0 (from file://[TEMP_DIR]/albatross-root-workspace)
+ anyio==4.3.0
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
+ tqdm==4.66.2
"###
"
);
// Run in `bird-feeder`. We shouldn't be able to import `albatross`, but we _can_ due to our
@ -608,7 +620,7 @@ fn test_uv_run_isolate() -> Result<()> {
.arg("--package")
.arg("bird-feeder")
.arg("check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r"
success: true
exit_code: 0
----- stdout -----
@ -616,9 +628,9 @@ fn test_uv_run_isolate() -> Result<()> {
----- stderr -----
warning: `VIRTUAL_ENV=[VENV]/` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
Resolved 8 packages in [TIME]
Audited 5 packages in [TIME]
"###
Resolved 5 packages in [TIME]
Audited 4 packages in [TIME]
"
);
// If we `--isolated`, though, we use an isolated virtual environment, so `albatross` is not
@ -631,24 +643,23 @@ fn test_uv_run_isolate() -> Result<()> {
.arg("--package")
.arg("bird-feeder")
.arg("check_installed_albatross.py")
.current_dir(&work_dir), @r###"
.current_dir(&work_dir), @r#"
success: false
exit_code: 1
----- stdout -----
----- stderr -----
Resolved 8 packages in [TIME]
Installed 5 packages in [TIME]
+ anyio==4.3.0
Resolved 5 packages in [TIME]
Installed 4 packages in [TIME]
+ bird-feeder==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/bird-feeder)
+ idna==3.6
+ iniconfig==2.0.0
+ seeds==1.0.0 (from file://[TEMP_DIR]/albatross-root-workspace/packages/seeds)
+ sniffio==1.3.1
Traceback (most recent call last):
File "[TEMP_DIR]/albatross-root-workspace/check_installed_albatross.py", line 1, in <module>
from albatross import fly
ModuleNotFoundError: No module named 'albatross'
"###
"#
);
Ok(())

View file

@ -2,7 +2,7 @@
name = "bird-feeder"
version = "1.0.0"
requires-python = ">=3.12"
dependencies = ["anyio>=4.3.0,<5"]
dependencies = ["iniconfig>=2,<3"]
[build-system]
requires = ["hatchling"]

View file

@ -1,4 +1,4 @@
import anyio
import iniconfig
def use():

View file

@ -2,7 +2,7 @@
name = "albatross"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["tqdm>=4,<5"]
dependencies = ["iniconfig>=2,<3"]
[build-system]
requires = ["hatchling"]

View file

@ -1,4 +1,4 @@
import tqdm
import iniconfig
def fly():

View file

@ -2,7 +2,7 @@
name = "albatross"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["tqdm>=4,<5"]
dependencies = ["iniconfig>=2,<3"]
[build-system]
requires = ["hatchling"]

View file

@ -2,7 +2,7 @@
name = "bird-feeder"
version = "1.0.0"
requires-python = ">=3.12"
dependencies = ["anyio>=4.3.0,<5"]
dependencies = ["iniconfig>=2,<3"]
[build-system]
requires = ["hatchling"]

View file

@ -1,4 +1,4 @@
import anyio
import iniconfig
def use():

View file

@ -2,7 +2,7 @@
name = "albatross"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["tqdm>=4,<5"]
dependencies = ["iniconfig>=2,<3"]
[tool.uv.workspace]
members = ["packages/*"]

View file

@ -1,4 +1,4 @@
import tqdm
import iniconfig
from bird_feeder import use
print("Caw")

View file

@ -2,7 +2,7 @@
name = "bird-feeder"
version = "1.0.0"
requires-python = ">=3.8"
dependencies = ["anyio>=4.3.0,<5", "seeds"]
dependencies = ["iniconfig>=2,<3", "seeds"]
[tool.uv.sources]
seeds = { workspace = true }

View file

@ -1,4 +1,4 @@
import anyio
import iniconfig
def use():

View file

@ -2,7 +2,7 @@
name = "albatross"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["bird-feeder", "tqdm>=4,<5"]
dependencies = ["bird-feeder", "iniconfig>=2,<3"]
[tool.uv.sources]
bird-feeder = { workspace = true }

View file

@ -1,4 +1,4 @@
import tqdm
import iniconfig
from bird_feeder import use

View file

@ -2,7 +2,7 @@
name = "albatross"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["bird-feeder", "tqdm>=4,<5"]
dependencies = ["bird-feeder", "iniconfig>=2,<3"]
[tool.uv.sources]
bird-feeder = { workspace = true }

View file

@ -1,4 +1,4 @@
import tqdm
import iniconfig
from bird_feeder import use