Skip to content

Commit b936111

Browse files
committed
Fix pull-through caching failing for improper named packages
1 parent f08aa5d commit b936111

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
@@ -164,3 +164,23 @@ def test_pull_through_local_only(
164164
r = requests.get(url)
165165
assert r.status_code == 404
166166
assert r.text == "pulp-python does not exist."
167+
168+
169+
@pytest.mark.parallel
170+
def test_pull_through_filtering_bad_names(python_remote_factory, python_distribution_factory):
171+
"""Tests that pull-through handles packages with invalid names gracefully."""
172+
# ipython version 0.13.X has improper named bdist_wininst, e.g ipython-0.13.py2-win-amd64.exe
173+
# pypi-simple expects the platform to go before the pyversion (for .exe), so when parsed the
174+
# version and package type will be None.
175+
remote = python_remote_factory(url=PYPI_URL, includes=["ipython"])
176+
distro = python_distribution_factory(remote=remote.pulp_href)
177+
178+
url = f"{distro.base_url}simple/ipython/"
179+
response = requests.get(url)
180+
181+
assert response.status_code == 200
182+
183+
project_page = ProjectPage.from_response(response, "ipython")
184+
# Should have no packages with None version (they get filtered out)
185+
assert len(project_page.packages) > 0
186+
assert all(package.version is not None for package in project_page.packages)

0 commit comments

Comments
 (0)