Skip to content

Commit 3e99867

Browse files
authored
Merge pull request #1088 from pulp/patchback/backports/3.24/6008980c5f36435fc2d019c4c150994f1fb07114/pr-1084
[PR #1084/6008980c backport][3.24] Fix pull-through caching failing for improper named packages
2 parents ecd5166 + f99f99c commit 3e99867

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

CHANGES/1040.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed pull-through caching failing for packages with bad names.

pulp_python/app/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def filter_release(self, project_name, version):
610610

611611
try:
612612
version = parse(version)
613-
except InvalidVersion:
613+
except (InvalidVersion, TypeError):
614614
return False
615615

616616
include_range = self._filter_includes.get("range", {})

pulp_python/tests/functional/api/test_full_mirror.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,23 @@ def test_pull_through_local_only(
182182
r = requests.get(url)
183183
assert r.status_code == 404
184184
assert r.text == "pulp-python does not exist."
185+
186+
187+
@pytest.mark.parallel
188+
def test_pull_through_filtering_bad_names(python_remote_factory, python_distribution_factory):
189+
"""Tests that pull-through handles packages with invalid names gracefully."""
190+
# ipython version 0.13.X has improper named bdist_wininst, e.g ipython-0.13.py2-win-amd64.exe
191+
# pypi-simple expects the platform to go before the pyversion (for .exe), so when parsed the
192+
# version and package type will be None.
193+
remote = python_remote_factory(url=PYPI_URL, includes=["ipython"])
194+
distro = python_distribution_factory(remote=remote.pulp_href)
195+
196+
url = f"{distro.base_url}simple/ipython/"
197+
response = requests.get(url)
198+
199+
assert response.status_code == 200
200+
201+
project_page = ProjectPage.from_response(response, "ipython")
202+
# Should have no packages with None version (they get filtered out)
203+
assert len(project_page.packages) > 0
204+
assert all(package.version is not None for package in project_page.packages)

0 commit comments

Comments
 (0)