-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scenarios: add more tests for resolver forks tracking markers
These tests were motivated by @konstin's question here: astral-sh/uv#4339 (comment)
- Loading branch information
1 parent
95b8af8
commit 2279c4d
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
scenarios/fork/allows-non-conflicting-non-overlapping-dependencies.toml
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,27 @@ | ||
name = "fork-allows-non-conflicting-non-overlapping-dependencies" | ||
description = ''' | ||
This test ensures that multiple non-conflicting but also | ||
non-overlapping dependency specifications with the same package name | ||
are allowed and supported. | ||
At time of writing, this provokes a fork in the resolver, but it | ||
arguably shouldn't since the requirements themselves do not conflict | ||
with one another. However, this does impact resolution. Namely, it | ||
leaves the `a>=1` fork free to choose `a==2.0.0` since it behaves as if | ||
the `a<2` constraint doesn't exist. | ||
''' | ||
|
||
[resolver_options] | ||
universal = true | ||
|
||
[expected] | ||
satisfiable = true | ||
|
||
[root] | ||
requires = [ | ||
"a>=1 ; sys_platform == 'linux'", | ||
"a<2 ; sys_platform == 'darwin'", | ||
] | ||
|
||
[packages.a.versions."1.0.0"] | ||
[packages.a.versions."2.0.0"] |
26 changes: 26 additions & 0 deletions
26
scenarios/fork/allows-non-conflicting-repeated-dependencies.toml
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,26 @@ | ||
name = "fork-allows-non-conflicting-repeated-dependencies" | ||
description = ''' | ||
This test ensures that multiple non-conflicting dependency | ||
specifications with the same package name are allowed and supported. | ||
This test exists because the universal resolver forks itself based on | ||
duplicate dependency specifications by looking at package name. So at | ||
first glance, a case like this could perhaps cause an errant fork. | ||
While it's difficult to test for "does not create a fork" (at time of | ||
writing, the implementation does not fork), we can at least check that | ||
this case is handled correctly without issue. Namely, forking should | ||
only occur when there are duplicate dependency specifications with | ||
disjoint marker expressions. | ||
''' | ||
|
||
[resolver_options] | ||
universal = true | ||
|
||
[expected] | ||
satisfiable = true | ||
|
||
[root] | ||
requires = ["a>=1", "a<2"] | ||
|
||
[packages.a.versions."1.0.0"] | ||
[packages.a.versions."2.0.0"] |
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,23 @@ | ||
name = "fork-conflict-unsatisfiable" | ||
description = ''' | ||
This test ensures that conflicting dependency specifications lead to an | ||
unsatisfiable result. | ||
In particular, this is a case that should not fork even though there | ||
are conflicting requirements because their marker expressions are | ||
overlapping. (Well, there aren't any marker expressions here, which | ||
means they are both unconditional.) | ||
''' | ||
|
||
[resolver_options] | ||
universal = true | ||
|
||
[expected] | ||
satisfiable = false | ||
|
||
[root] | ||
requires = ["a>=2", "a<2"] | ||
|
||
[packages.a.versions."1.0.0"] | ||
[packages.a.versions."2.0.0"] | ||
[packages.a.versions."3.0.0"] |