-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repositories: add support for PEP 691 as fallback for PyPI
- Loading branch information
Showing
12 changed files
with
388 additions
and
43 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
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
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
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
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
tests/repositories/fixtures/metadata/isort-metadata-4.3.4-py3-none-any.whl.metadata
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,28 @@ | ||
Metadata-Version: 2.0 | ||
Name: isort-metadata | ||
Version: 4.3.4 | ||
Summary: A Python utility / library to sort Python imports. | ||
Home-page: https://github.com/timothycrosley/isort | ||
Author: Timothy Crosley | ||
Author-email: timothy.crosley@gmail.com | ||
License: MIT | ||
Keywords: Refactor,Python,Python2,Python3,Refactoring,Imports,Sort,Clean | ||
Platform: UNKNOWN | ||
Classifier: Development Status :: 6 - Mature | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Natural Language :: English | ||
Classifier: Environment :: Console | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Programming Language :: Python | ||
Classifier: Programming Language :: Python :: 2 | ||
Classifier: Programming Language :: Python :: 2.7 | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Programming Language :: Python :: 3.4 | ||
Classifier: Programming Language :: Python :: 3.5 | ||
Classifier: Programming Language :: Python :: 3.6 | ||
Classifier: Programming Language :: Python :: Implementation :: CPython | ||
Classifier: Programming Language :: Python :: Implementation :: PyPy | ||
Classifier: Topic :: Software Development :: Libraries | ||
Classifier: Topic :: Utilities | ||
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* | ||
Requires-Dist: futures; python_version=="2.7" |
35 changes: 35 additions & 0 deletions
35
tests/repositories/fixtures/pypi.org/json/isort-metadata.json
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,35 @@ | ||
{ | ||
"name": "isort-metadata", | ||
"files": [ | ||
{ | ||
"filename": "isort-metadata-4.3.4-py2-none-any.whl", | ||
"url": "https://files.pythonhosted.org/packages/41/d8/a945da414f2adc1d9e2f7d6e7445b27f2be42766879062a2e63616ad4199/isort-metadata-4.3.4-py2-none-any.whl", | ||
"core-metadata": true, | ||
"hashes": { | ||
"md5": "f0ad7704b6dc947073398ba290c3517f", | ||
"sha256": "ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497" | ||
} | ||
}, | ||
{ | ||
"filename": "isort-metadata-4.3.4-py3-none-any.whl", | ||
"url": "https://files.pythonhosted.org/packages/1f/2c/22eee714d7199ae0464beda6ad5fedec8fee6a2f7ffd1e8f1840928fe318/isort-metadata-4.3.4-py3-none-any.whl", | ||
"core-metadata": true, | ||
"hashes": { | ||
"md5": "fbaac4cd669ac21ea9e21ab1ea3180db", | ||
"sha256": "1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af" | ||
} | ||
}, | ||
{ | ||
"filename": "isort-metadata-4.3.4.tar.gz", | ||
"url": "https://files.pythonhosted.org/packages/b1/de/a628d16fdba0d38cafb3d7e34d4830f2c9cb3881384ce5c08c44762e1846/isort-metadata-4.3.4.tar.gz", | ||
"hashes": { | ||
"md5": "fb554e9c8f9aa76e333a03d470a5cf52", | ||
"sha256": "b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8" | ||
} | ||
} | ||
], | ||
"meta": { | ||
"api-version": "1.0", | ||
"_last-serial": 3575149 | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
tests/repositories/fixtures/pypi.org/json/isort-metadata/4.3.4.json
Large diffs are not rendered by default.
Oops, something went wrong.
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,84 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
from poetry.repositories.link_sources.json import SimpleJsonPage | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"metadata, expected_has_metadata, expected_hash_name, expected_hash", | ||
[ | ||
({}, False, None, None), | ||
# new | ||
({"core-metadata": False}, False, None, None), | ||
({"core-metadata": True}, True, None, None), | ||
({"core-metadata": {"sha1": "1234", "sha256": "abcd"}}, True, "sha256", "abcd"), | ||
({"core-metadata": {}}, False, None, None), | ||
( | ||
{"core-metadata": {"sha1": "1234", "sha256": "abcd"}}, | ||
True, | ||
"sha256", | ||
"abcd", | ||
), | ||
# old | ||
({"dist-info-metadata": False}, False, None, None), | ||
({"dist-info-metadata": True}, True, None, None), | ||
({"dist-info-metadata": {"sha256": "abcd"}}, True, "sha256", "abcd"), | ||
({"dist-info-metadata": {}}, False, None, None), | ||
( | ||
{"dist-info-metadata": {"sha1": "1234", "sha256": "abcd"}}, | ||
True, | ||
"sha256", | ||
"abcd", | ||
), | ||
# conflicting (new wins) | ||
({"core-metadata": False, "dist-info-metadata": True}, False, None, None), | ||
( | ||
{"core-metadata": False, "dist-info-metadata": {"sha256": "abcd"}}, | ||
False, | ||
None, | ||
None, | ||
), | ||
({"core-metadata": True, "dist-info-metadata": False}, True, None, None), | ||
( | ||
{"core-metadata": True, "dist-info-metadata": {"sha256": "abcd"}}, | ||
True, | ||
None, | ||
None, | ||
), | ||
( | ||
{"core-metadata": {"sha256": "abcd"}, "dist-info-metadata": False}, | ||
True, | ||
"sha256", | ||
"abcd", | ||
), | ||
( | ||
{"core-metadata": {"sha256": "abcd"}, "dist-info-metadata": True}, | ||
True, | ||
"sha256", | ||
"abcd", | ||
), | ||
( | ||
{ | ||
"core-metadata": {"sha256": "abcd"}, | ||
"dist-info-metadata": {"sha256": "1234"}, | ||
}, | ||
True, | ||
"sha256", | ||
"abcd", | ||
), | ||
], | ||
) | ||
def test_metadata( | ||
metadata: dict[str, bool | dict[str, str]], | ||
expected_has_metadata: bool, | ||
expected_hash_name: str | None, | ||
expected_hash: str | None, | ||
) -> None: | ||
content = {"files": [{"url": "https://example.org/demo-0.1.whl", **metadata}]} | ||
page = SimpleJsonPage("https://example.org", content) | ||
|
||
link = next(page.links) | ||
assert link.has_metadata is expected_has_metadata | ||
assert link.metadata_hash_name == expected_hash_name | ||
assert link.metadata_hash == expected_hash |
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
Oops, something went wrong.