Skip to content

Commit

Permalink
scenarios: add tests involving "local" versions
Browse files Browse the repository at this point in the history
None of these currently pass on `uv pip install` but they all should.
(Or at least, I believe they all work with `pip install`.)
  • Loading branch information
BurntSushi committed Feb 28, 2024
1 parent 545c4ea commit 4db9ac1
Showing 1 changed file with 191 additions and 0 deletions.
191 changes: 191 additions & 0 deletions scenarios/local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
[
{
"name": "local-simple",
"description": "A simple version constraint should not exclude published versions with local segments.",
"root": {
"requires": [
"a==1.2.3"
]
},
"packages": {
"a": {
"versions": {
"1.2.3+foo": {}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "1.2.3+foo"
},
"explanation": "The verison '1.2.3+foo' satisfies the constraint '==1.2.3'."
}
},
{
"name": "local-not-used-with-sdist",
"description": "If there is a 1.2.3 version with an sdist published and no compatible wheels, then the sdist will be used.",
"root": {
"requires": [
"a==1.2.3"
]
},
"packages": {
"a": {
"versions": {
"1.2.3": {
"wheel_tags": [
"py3-any-macosx_10_0_ppc64"
],
"sdist": true
},
"1.2.3+foo": {}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "1.2.3"
},
"explanation": "The verison '1.2.3' with an sdist satisfies the constraint '==1.2.3'."
}
},
{
"name": "local-used-without-sdist",
"description": "Even if there is a 1.2.3 version published, if it is unavailable for some reason (no sdist and no compatible wheels in this case), a 1.2.3 version with a local segment should be usable instead.",
"root": {
"requires": [
"a==1.2.3"
]
},
"packages": {
"a": {
"versions": {
"1.2.3": {
"wheel_tags": [
"py3-any-macosx_10_0_ppc64"
],
"sdist": false
},
"1.2.3+foo": {}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "1.2.3+foo"
},
"explanation": "The verison '1.2.3+foo' satisfies the constraint '==1.2.3'."
}
},
{
"name": "local-not-latest",
"description": "Tests that we can select an older version with a local segment when newer versions are incompatible.",
"root": {
"requires": [
"a>=1"
]
},
"packages": {
"a": {
"versions": {
"1.2.3": {
"wheel_tags": [
"py3-any-macosx_10_0_ppc64"
],
"sdist": false
},
"1.2.2+foo": {
"wheel_tags": [
"py3-any-macosx_10_0_ppc64"
],
"sdist": false
},
"1.2.1+foo": {
"sdist": true
}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "1.2.1+foo"
}
}
},
{
"name": "local-transitive",
"description": "A simple version constraint should not exclude published versions with local segments.",
"root": {
"requires": [
"a",
"b==2.0.0+foo"
]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"requires": [
"b==2.0.0"
]
}
}
},
"b": {
"versions": {
"2.0.0+foo": {}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "1.0.0",
"b": "2.0.0+foo"
},
"explanation": "The verison '2.0.0+foo' satisfies both ==2.0.0 and ==2.0.0+foo."
}
},
{
"name": "local-transitive-confounding",
"description": "A transitive dependency has both a non-local and local version published, but the non-local version is unuable.",
"root": {
"requires": [
"a"
]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"requires": [
"b==2.0.0"
]
}
}
},
"b": {
"versions": {
"2.0.0": {
"wheel_tags": [
"py3-any-macosx_10_0_ppc64"
],
"sdist": false
},
"2.0.0+foo": {}
}
}
},
"expected": {
"satisfiable": true,
"packages": {
"a": "2.0.0+foo"
},
"explanation": "The verison '1.2.3+foo' satisfies the constraint '==1.2.3'."
}
}
]

0 comments on commit 4db9ac1

Please sign in to comment.