Skip to content

Commit cc701f4

Browse files
committed
Fix pull-through caching failing for improper named packages
1 parent 3702ba6 commit cc701f4

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

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
@@ -458,7 +458,7 @@ def filter_release(self, project_name, version):
458458

459459
try:
460460
version = parse(version)
461-
except InvalidVersion:
461+
except (InvalidVersion, TypeError):
462462
return False
463463

464464
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
@@ -138,3 +138,23 @@ def test_pull_through_with_repo(
138138
assert r.status_code == 200
139139
tasks = pulpcore_bindings.TasksApi.list(reserved_resources=repo.prn)
140140
assert tasks.count == 3
141+
142+
143+
@pytest.mark.parallel
144+
def test_pull_through_filtering_bad_names(python_remote_factory, python_distribution_factory):
145+
"""Tests that pull-through handles packages with invalid names gracefully."""
146+
# ipython version 0.13.X has improper named bdist_wininst, e.g ipython-0.13.py2-win-amd64.exe
147+
# pypi-simple expects the platform to go before the pyversion (for .exe), so when parsed the
148+
# version and package type will be None.
149+
remote = python_remote_factory(url=PYPI_URL, includes=["ipython"])
150+
distro = python_distribution_factory(remote=remote.pulp_href)
151+
152+
url = f"{distro.base_url}simple/ipython/"
153+
response = requests.get(url)
154+
155+
assert response.status_code == 200
156+
157+
project_page = ProjectPage.from_response(response, "ipython")
158+
# Should have no packages with None version (they get filtered out)
159+
assert len(project_page.packages) > 0
160+
assert all(package.version is not None for package in project_page.packages)

0 commit comments

Comments
 (0)