Skip to content

Commit

Permalink
Add test for unreachable packages and wheels (#217)
Browse files Browse the repository at this point in the history
Add tests for astral-sh/uv#6959 and
astral-sh/uv#6961.

Tested with:

```toml
[project]
name = "foo"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["unreachable-package", "unreachable-wheels", "requires-python-wheels"]

[tool.uv]
index-url = "http://localhost:3141"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```

Lockfile:
```toml
version = 1
requires-python = ">=3.10"

[[package]]
name = "foo"
version = "0.1.0"
source = { editable = "." }
dependencies = [
    { name = "requires-python-wheels" },
    { name = "unreachable-package" },
    { name = "unreachable-wheels" },
]

[package.metadata]
requires-dist = [
    { name = "requires-python-wheels" },
    { name = "unreachable-package" },
    { name = "unreachable-wheels" },
]

[[package]]
name = "requires-python-wheels"
version = "0.0.0"
source = { registry = "http://localhost:3141/" }
dependencies = [
    { name = "requires-python-wheels-a" },
]
sdist = { url = "http://localhost:3141/packages/requires-python-wheels/requires_python_wheels-0.0.0.tar.gz", hash = "sha256:79ffa0fd695959b2dbee964c9990516db032ce8983af43c6d9b32ff4a84499a9" }

[[package]]
name = "requires-python-wheels-a"
version = "1.0.0"
source = { registry = "http://localhost:3141/" }
sdist = { url = "http://localhost:3141/packages/requires-python-wheels/requires_python_wheels_a-1.0.0.tar.gz", hash = "sha256:9a11ff73fdc513c4dab0d3e137f4145a00ef0dfc95154360c8f503eed62a03c9" }
wheels = [
    { url = "http://localhost:3141/packages/requires-python-wheels/requires_python_wheels_a-1.0.0-cp310-cp310-any.whl", hash = "sha256:b979494a0d7dc825b84d6c516ac407143915f6d2840d229ee2a36b3d06deb61d" },
    { url = "http://localhost:3141/packages/requires-python-wheels/requires_python_wheels_a-1.0.0-cp311-cp311-any.whl", hash = "sha256:b979494a0d7dc825b84d6c516ac407143915f6d2840d229ee2a36b3d06deb61d" },
]

[[package]]
name = "unreachable-package"
version = "0.0.0"
source = { registry = "http://localhost:3141/" }
dependencies = [
    { name = "unreachable-package-a", marker = "sys_platform == 'win32'" },
]
sdist = { url = "http://localhost:3141/packages/unreachable-package/unreachable_package-0.0.0.tar.gz", hash = "sha256:f5d940dd2f21645b87d052b22042cca4d10e5af1c456d32946325eb36eea818e" }

[[package]]
name = "unreachable-package-a"
version = "1.0.0"
source = { registry = "http://localhost:3141/" }
sdist = { url = "http://localhost:3141/packages/unreachable-package/unreachable_package_a-1.0.0.tar.gz", hash = "sha256:308f0b6772e99dcb33acee38003b176e3acffbe01c3c511585db9a7d7ec008f7" }
wheels = [
    { url = "http://localhost:3141/packages/unreachable-package/unreachable_package_a-1.0.0-py3-none-any.whl", hash = "sha256:cc472ded9f3b260e6cda0e633fa407a13607e190422cb455f02beebd32d6751f" },
]

[[package]]
name = "unreachable-wheels"
version = "0.0.0"
source = { registry = "http://localhost:3141/" }
dependencies = [
    { name = "unreachable-wheels-a", marker = "sys_platform == 'win32'" },
    { name = "unreachable-wheels-b", marker = "sys_platform == 'linux'" },
    { name = "unreachable-wheels-c", marker = "sys_platform == 'darwin'" },
]
sdist = { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels-0.0.0.tar.gz", hash = "sha256:6a1da25cbd20e512e219dae85569f20208377d16c004a3e1c5bcbd615c5f5e9e" }

[[package]]
name = "unreachable-wheels-a"
version = "1.0.0"
source = { registry = "http://localhost:3141/" }
sdist = { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_a-1.0.0.tar.gz", hash = "sha256:91c6619d1cfa227f3662c0c062b1c0c16efe11e589db2f1836e809e2c6d9961e" }
wheels = [
    { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_a-1.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:e9fb30c5eb114114f9031d0ad2238614c2dcce203c5992848305ccda8f38a53e" },
]

[[package]]
name = "unreachable-wheels-b"
version = "1.0.0"
source = { registry = "http://localhost:3141/" }
sdist = { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_b-1.0.0.tar.gz", hash = "sha256:253ae69b963651cd5ac16601a445e2e179db9eac552e8cfc37aadf73a88931ed" }
wheels = [
    { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_b-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3de2212ca86f1137324965899ce7f48640ed8db94578f4078d641520b77e13e" },
    { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_b-1.0.0-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:a3de2212ca86f1137324965899ce7f48640ed8db94578f4078d641520b77e13e" },
]

[[package]]
name = "unreachable-wheels-c"
version = "1.0.0"
source = { registry = "http://localhost:3141/" }
sdist = { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_c-1.0.0.tar.gz", hash = "sha256:5c4783e85f0fa57b720fd02b5c7e0ff8bc98121546fe2cce435710efe4a34b28" }
wheels = [
    { url = "http://localhost:3141/packages/unreachable-wheels/unreachable_wheels_c-1.0.0-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:4b846c5b1646b04828a2bef6c9d180ff7cfd725866013dcec8933de7fb5f9e8d" },
]
```
Looks all correct
  • Loading branch information
konstin authored Sep 3, 2024
1 parent c83ef76 commit ea4cd15
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions scenarios/tag-and-markers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
[
{
"name": "unreachable-package",
"description": "`c` is not reachable due to the markers, it should be excluded from the lockfile",
"root": {
"requires": [
"a==1.0.0; sys_platform == 'win32'"
]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"requires": ["b==1.0.0; sys_platform == 'linux'"]
}
}
},
"b": {
"versions": {
"1.0.0": {}
}
}
},
"expected": {
"satisfiable": true
},
"resolver_options": {
"universal": true
}
},
{
"name": "unreachable-wheels",
"description": "Check that we only include wheels that match the platform markers",
"root": {
"requires": [
"a==1.0.0; sys_platform == 'win32'",
"b==1.0.0; sys_platform == 'linux'",
"c==1.0.0; sys_platform == 'darwin'"
]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"wheel_tags": [
"cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64",
"cp312-cp312-musllinux_1_1_armv7l",
"cp312-cp312-win_amd64",
"cp312-cp312-macosx_14_0_x86_64"
]
}
}
},
"b": {
"versions": {
"1.0.0": {
"wheel_tags": [
"cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64",
"cp312-cp312-musllinux_1_1_armv7l",
"cp312-cp312-win_amd64",
"cp312-cp312-macosx_14_0_x86_64"
]
}
}
},
"c": {
"versions": {
"1.0.0": {
"wheel_tags": [
"cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64",
"cp312-cp312-musllinux_1_1_armv7l",
"cp312-cp312-win_amd64",
"cp312-cp312-macosx_14_0_x86_64"
]
}
}
}
},
"expected": {
"satisfiable": true
},
"resolver_options": {
"universal": true
}
},
{
"name": "requires-python-wheels",
"description": "Check that we only include wheels that match the required Python version",
"root": {
"requires_python": ">=3.10",
"requires": [
"a==1.0.0"
]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"wheel_tags": [
"cp311-cp311-any",
"cp310-cp310-any",
"cp39-cp39-any"
]
}
}
}
},
"expected": {
"satisfiable": true
},
"resolver_options": {
"universal": true
}
}
]

0 comments on commit ea4cd15

Please sign in to comment.