Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scenarios: add more tests for resolver forks tracking markers #196

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 scenarios/fork/allows-non-conflicting-repeated-dependencies.toml
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"]
23 changes: 23 additions & 0 deletions scenarios/fork/conflict-unsatisfiable.toml
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"]