Skip to content

Commit ec9780e

Browse files
ryanpetrelloclaude
andcommitted
fix: address review feedback on RSS GUID stability
Import _build_tag_fragment from feeds.py in unit tests instead of duplicating the function. Add pytest-django to unittest_requirements.txt to support the Django import. Use single backticks in the docstring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ryan Petrello <ryan@ryanpetrello.com>
1 parent 28a4710 commit ec9780e

3 files changed

Lines changed: 3 additions & 17 deletions

File tree

‎pulp_python/app/pypi/feeds.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def iter_projects(content, repo_ver, limit=PACKAGES_LIMIT):
9898
def _build_tag_fragment(filenames):
9999
"""Extract sorted distinct build tags from wheel filenames for GUID stability.
100100
101-
Returns a fragment like ``#builds=1,2`` when build tags are present,
101+
Returns a fragment like `#builds=1,2` when build tags are present,
102102
or an empty string for sdists and wheels without build tags.
103103
"""
104104
tags = set()

‎pulp_python/tests/unit/test_feeds.py‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
import re
2-
31
import pytest
42

5-
# Duplicated here to avoid importing feeds.py, which pulls in Django/DRF and
6-
# requires a configured Django settings module that the unit test runner lacks.
7-
_WHEEL_BUILD_TAG_RE = re.compile(r"^.+?-.+?-(?P<build>\d[^-]*?)-[^-]+-[^-]+-[^-]+\.whl$")
8-
9-
10-
def _build_tag_fragment(filenames):
11-
tags = set()
12-
for fn in filenames or ():
13-
m = _WHEEL_BUILD_TAG_RE.match(fn)
14-
if m:
15-
tags.add(m.group("build"))
16-
if not tags:
17-
return ""
18-
return "#builds=" + ",".join(sorted(tags))
3+
from pulp_python.app.pypi.feeds import _build_tag_fragment
194

205

216
@pytest.mark.parametrize(

‎unittest_requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mock
22
pytest<8
3+
pytest-django

0 commit comments

Comments
 (0)