mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add scenario tests for pip-compile
(#1011)
e.g. for scenarios that test resolution _without_ installation.
This refactors the `update` script to generate scenario test files for
`pip compile` _and_ `pip install`. We don't overlap scenarios to save
time. We only generate `pip compile` test cases for scenarios we cannot
represent with `pip install` e.g. a `--python-version` override.
The _one_ scenario I added happened to reveal a bug in our resolver
where we were incorrectly filtering versions by the installed version
when wheels were available. Per the comment at
https://github.com/astral-sh/puffin/issues/883#issuecomment-1890773112,
we should _only_ need to check for a compatible installed Python version
when using a different _target_ Python version if we need to build a
source distribution.
53bce68400
resolves this by removing the excessive constraints — the correct Python
version incompatibilities are applied elsewhere.
This commit is contained in:
parent
d9cc9dbf88
commit
4026710189
6 changed files with 224 additions and 54 deletions
|
@ -652,22 +652,6 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
|||
self.visit_package(package, priorities, request_sink)?;
|
||||
}
|
||||
|
||||
// If a package has a `requires_python` field, add a constraint on the target
|
||||
// Python version.
|
||||
if let Some(requires_python) = metadata.requires_python.as_ref() {
|
||||
let version = requires_python
|
||||
.iter()
|
||||
.map(PubGrubSpecifier::try_from)
|
||||
.fold_ok(Range::full(), |range, specifier| {
|
||||
range.intersection(&specifier.into())
|
||||
})?;
|
||||
constraints.insert(
|
||||
PubGrubPackage::Python(PubGrubPython::Installed),
|
||||
version.clone(),
|
||||
);
|
||||
constraints.insert(PubGrubPackage::Python(PubGrubPython::Target), version);
|
||||
}
|
||||
|
||||
// If a package has an extra, insert a constraint on the base package.
|
||||
if extra.is_some() {
|
||||
constraints.insert(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue