mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-30 14:01:13 +00:00
Add test for extra-in-constraint (#3231)
## Summary We have the wrong behavior here, so starting by adding a test for it.
This commit is contained in:
parent
084408b88f
commit
c7d7b07408
1 changed files with 48 additions and 0 deletions
|
@ -288,6 +288,54 @@ fn compile_constraints_markers() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Resolve a package from a `requirements.in` file, with a `constraints.txt` file that uses an
|
||||
/// extra. The constraint should be enforced, but the extra should _not_ be included in the output
|
||||
/// (though it currently _is_ included).
|
||||
#[test]
|
||||
fn compile_constraint_extra() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("flask")?;
|
||||
|
||||
// Constrain a transitive dependency based on the Python version
|
||||
let constraints_txt = context.temp_dir.child("constraints.txt");
|
||||
constraints_txt.write_str("flask[dotenv]<24.3.0")?;
|
||||
|
||||
uv_snapshot!(context.compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--constraint")
|
||||
.arg("constraints.txt"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --constraint constraints.txt
|
||||
blinker==1.7.0
|
||||
# via flask
|
||||
click==8.1.7
|
||||
# via flask
|
||||
flask==3.0.2
|
||||
itsdangerous==2.1.2
|
||||
# via flask
|
||||
jinja2==3.1.3
|
||||
# via flask
|
||||
markupsafe==2.1.5
|
||||
# via
|
||||
# jinja2
|
||||
# werkzeug
|
||||
python-dotenv==1.0.1
|
||||
# via flask
|
||||
werkzeug==3.0.1
|
||||
# via flask
|
||||
|
||||
----- stderr -----
|
||||
Resolved 8 packages in [TIME]
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Resolve a package from an optional dependency group in a `pyproject.toml` file.
|
||||
#[test]
|
||||
fn compile_pyproject_toml_extra() -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue