Skip to content

Commit dd8a085

Browse files
committed
Add support for Core Metadata 2.5 (PEP 794)
closes #1321
1 parent 275c161 commit dd8a085

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

CHANGES/1321.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added support for Core Metadata 2.5 (PEP 794).

pulp_python/app/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
PYPI_LAST_SERIAL = "X-PYPI-LAST-SERIAL"
3131
"""TODO This serial constant is temporary until Python repositories implements serials"""
3232
PYPI_SERIAL_CONSTANT = 1000000000
33-
SUPPORTED_METADATA_VERSIONS = ("1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4")
33+
SUPPORTED_METADATA_VERSIONS = ("1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5")
3434

3535
SIMPLE_API_VERSION = "1.1"
3636
PYPI_SIMPLE_V1_HTML = "application/vnd.pypi.simple.v1+html"

pulp_python/tests/functional/api/test_upload.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pytest
44
import requests
5+
from pypi_simple import PyPISimple
56

67
from pulp_python.tests.functional.constants import (
78
PYTHON_EGG_FILENAME,
@@ -152,3 +153,24 @@ def test_legacy_upload_invalid_metadata_version(
152153
)
153154
assert response.status_code == 400
154155
assert response.json()["metadata_version"] == ['"3.0" is not a valid choice.']
156+
157+
158+
@pytest.mark.parallel
159+
def test_legacy_upload_metadata_25(python_empty_repo_distro, python_package_dist_directory):
160+
"""Test that packages with metadata_version 2.5 (PEP 794) can be uploaded."""
161+
with PyPISimple() as client:
162+
page = client.get_project_page("flit")
163+
flit_url = next(p.url for p in page.packages if p.filename == "flit-4.0.2-py3-none-any.whl")
164+
165+
_, flit_file = python_package_dist_directory(flit_url)
166+
_, distro = python_empty_repo_distro()
167+
url = urljoin(distro.base_url, "legacy/")
168+
sha256 = "7b0b0038cd91a7f04e2e287d958dc5f25e68ffeed0b93e613bd50aec99a0d9ca"
169+
with open(flit_file, "rb") as f:
170+
response = requests.post(
171+
url,
172+
data={"sha256_digest": sha256, "metadata_version": "2.5"},
173+
files={"content": f},
174+
auth=("admin", "password"),
175+
)
176+
assert response.status_code == 202

0 commit comments

Comments
 (0)