Skip to content

Commit

Permalink
Add a uv pip install --group test case with default-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jan 23, 2025
1 parent b2dac99 commit edd96e7
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions crates/uv/tests/it/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8501,6 +8501,71 @@ fn dependency_group() -> Result<()> {
Ok(())
}

#[test]
fn dependency_group_default_groups() -> Result<()> {
fn new_context() -> Result<TestContext> {
let context = TestContext::new("3.12");

let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["typing-extensions"]
[tool.uv]
default-groups = ["foo", "bar"]
[dependency-groups]
foo = ["sortedcontainers"]
bar = ["iniconfig"]
dev = ["sniffio"]
"#,
)?;

context.lock().assert().success();
Ok(context)
}

let mut context;

// We should not install the default groups
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ typing-extensions==4.10.0
"###);

// Selecting a group works as normal
context = new_context()?;
uv_snapshot!(context.filters(), context.pip_install()
.arg("-r").arg("pyproject.toml")
.arg("--only-group").arg("bar"), @r###"
success: true
exit_code: 0
----- stdout -----
----- stderr -----
Resolved 2 packages in [TIME]
Prepared 2 packages in [TIME]
Installed 2 packages in [TIME]
+ iniconfig==2.0.0
+ typing-extensions==4.10.0
"###);

Ok(())
}

#[test]
fn many_pyproject_group() -> Result<()> {
fn new_context() -> Result<TestContext> {
Expand Down

0 comments on commit edd96e7

Please sign in to comment.