-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scenarios/fork: add basic overlapping markers test case
The description explains its utility and how it fails on current `uv`.
- Loading branch information
1 parent
8eca8fc
commit 91c7b36
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name = "fork-overlapping-markers-basic" | ||
description = ''' | ||
This scenario tests a very basic case of overlapping markers. Namely, | ||
it emulates a common pattern in the ecosystem where marker expressions | ||
are used to progressively increase the version constraints of a package | ||
as the Python version increases. | ||
In this case, there is actually a split occurring between | ||
`python_version < '3.10'` and the other marker expressions, so this | ||
isn't just a scenario with overlapping but non-disjoint markers. | ||
In particular, this serves as a regression test. uv used to create a | ||
lock file with a dependency on `a` with the following markers: | ||
python_version < '3.10' or python_version >= '3.11' | ||
But this implies that `a` won't be installed for Python 3.10, which is | ||
clearly wrong. | ||
The issue was that uv was intersecting *all* marker expressions. So | ||
that `a>=1.1.0` and `a>=1.2.0` fork was getting `python_version >= | ||
'3.10' and python_version >= '3.11'`, which, of course, simplifies | ||
to `python_version >= '3.11'`. But this is wrong! It should be | ||
`python_version >= '3.10' or python_version >= '3.11'`, which of course | ||
simplifies to `python_version >= '3.10'`. And thus, the resulting forks | ||
are not just disjoint but complete in this case. | ||
Since there are no other constraints on `a`, this causes uv to select | ||
`1.2.0` unconditionally. (The marker expressions get normalized out | ||
entirely.) | ||
''' | ||
|
||
[resolver_options] | ||
universal = true | ||
|
||
[expected] | ||
satisfiable = true | ||
|
||
[root] | ||
requires = [ | ||
"a>=1.0.0 ; python_version < '3.10'", | ||
"a>=1.1.0 ; python_version >= '3.10'", | ||
"a>=1.2.0 ; python_version >= '3.11'", | ||
] | ||
|
||
[packages.a.versions."1.0.0"] | ||
[packages.a.versions."1.1.0"] | ||
[packages.a.versions."1.2.0"] |