mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add test for avoiding irrelevant extras (#3107)
## Summary This PR adds a test that currently leads to an error, but should successfully resolve as of https://github.com/astral-sh/uv/pull/3100. The core idea is that if we have a pinned package, we shouldn't try to build other versions of that package if we have an unconstrained variant with an extra.
This commit is contained in:
parent
3c9d925531
commit
5ca5d7da67
3 changed files with 52 additions and 0 deletions
|
@ -3901,6 +3901,58 @@ fn find_links_requirements_txt() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `extras==0.0.2` fails to build (i.e., it always throws). Since `extras==0.0.1` is pinned, we
|
||||||
|
/// should never even attempt to build `extras==0.0.2`, despite an unpinned `extras[dev]`
|
||||||
|
/// requirement.
|
||||||
|
///
|
||||||
|
/// This resolution should succeed, but currently fails.
|
||||||
|
#[test]
|
||||||
|
fn avoid_irrelevant_extras() -> Result<()> {
|
||||||
|
let context = TestContext::new("3.12");
|
||||||
|
let requirements_in = context.temp_dir.child("requirements.in");
|
||||||
|
requirements_in.write_str(indoc! {r"
|
||||||
|
extras==0.0.1
|
||||||
|
extras[dev]
|
||||||
|
"})?;
|
||||||
|
|
||||||
|
let filters = std::iter::once((r"exit code: 1", "exit status: 1"))
|
||||||
|
.chain(context.filters())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
uv_snapshot!(filters, context.compile()
|
||||||
|
.arg("requirements.in")
|
||||||
|
.arg("--find-links")
|
||||||
|
.arg(context.workspace_root.join("scripts").join("links")), @r###"
|
||||||
|
success: false
|
||||||
|
exit_code: 2
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
error: Failed to download and build: extras==0.0.2
|
||||||
|
Caused by: Failed to build: extras==0.0.2
|
||||||
|
Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
|
||||||
|
--- stdout:
|
||||||
|
|
||||||
|
--- stderr:
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<string>", line 14, in <module>
|
||||||
|
File "[CACHE_DIR]/[TMP]/build_meta.py", line 325, in get_requires_for_build_wheel
|
||||||
|
return self._get_build_requires(config_settings, requirements=['wheel'])
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "[CACHE_DIR]/[TMP]/build_meta.py", line 295, in _get_build_requires
|
||||||
|
self.run_setup()
|
||||||
|
File "[CACHE_DIR]/[TMP]/build_meta.py", line 487, in run_setup
|
||||||
|
super().run_setup(setup_script=setup_script)
|
||||||
|
File "[CACHE_DIR]/[TMP]/build_meta.py", line 311, in run_setup
|
||||||
|
exec(code, locals())
|
||||||
|
File "<string>", line 3, in <module>
|
||||||
|
ZeroDivisionError: division by zero
|
||||||
|
---
|
||||||
|
"###);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Use an existing resolution for `black==23.10.1`, with stale versions of `click` and `pathspec`.
|
/// Use an existing resolution for `black==23.10.1`, with stale versions of `click` and `pathspec`.
|
||||||
/// Nothing should change.
|
/// Nothing should change.
|
||||||
#[test]
|
#[test]
|
||||||
|
|
BIN
scripts/links/extras-0.0.1.tar.gz
Normal file
BIN
scripts/links/extras-0.0.1.tar.gz
Normal file
Binary file not shown.
BIN
scripts/links/extras-0.0.2.tar.gz
Normal file
BIN
scripts/links/extras-0.0.2.tar.gz
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue