mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-02 15:01:16 +00:00
Add pip install --constraint
test coverage (#1334)
Exploring behavior reported in https://github.com/astral-sh/uv/issues/1332
This commit is contained in:
parent
f25781ff6c
commit
89ad1c6fa1
1 changed files with 62 additions and 0 deletions
|
@ -1012,3 +1012,65 @@ fn install_upgrade() {
|
|||
"###
|
||||
);
|
||||
}
|
||||
|
||||
/// Install a package from a `requirements.txt` file, with a `constraints.txt` file.
|
||||
#[test]
|
||||
fn install_constraints_txt() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let requirementstxt = context.temp_dir.child("requirements.txt");
|
||||
requirementstxt.write_str("django==5.0b1")?;
|
||||
|
||||
let constraints_txt = context.temp_dir.child("constraints.txt");
|
||||
constraints_txt.write_str("sqlparse<0.4.4")?;
|
||||
|
||||
uv_snapshot!(command(&context)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt")
|
||||
.arg("--constraint")
|
||||
.arg("constraints.txt"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Resolved 3 packages in [TIME]
|
||||
Downloaded 3 packages in [TIME]
|
||||
Installed 3 packages in [TIME]
|
||||
+ asgiref==3.7.2
|
||||
+ django==5.0b1
|
||||
+ sqlparse==0.4.3
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Install a package from a `requirements.txt` file, with an inline constraint.
|
||||
#[test]
|
||||
fn install_constraints_inline() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let requirementstxt = context.temp_dir.child("requirements.txt");
|
||||
requirementstxt.write_str("django==5.0b1\n-c constraints.txt")?;
|
||||
|
||||
let constraints_txt = context.temp_dir.child("constraints.txt");
|
||||
constraints_txt.write_str("sqlparse<0.4.4")?;
|
||||
|
||||
uv_snapshot!(command(&context)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Resolved 3 packages in [TIME]
|
||||
Downloaded 3 packages in [TIME]
|
||||
Installed 3 packages in [TIME]
|
||||
+ asgiref==3.7.2
|
||||
+ django==5.0b1
|
||||
+ sqlparse==0.4.3
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue