Skip to content

Commit 55ccaf7

Browse files
authored
chore: update Python 3.12.6 (#16700)
* chore: update Python 3.12.6 Refs: https://www.python.org/downloads/release/python-3126/ Signed-off-by: Mike Fiedler <[email protected]> * chore: remove unreachable condition Now that Python validates the addresses more strictly, we won't hit the condition any longer. If we wish to preserve this condition, we could also pass `strict=False` to `getaddresses()`, but that seems to be counter to our desire of having a valid email address. Refs: python/cpython#123766 Signed-off-by: Mike Fiedler <[email protected]> * test: refactor test case to parametrize Extract test cases from inline to make it clearer which permutations are being tested. Signed-off-by: Mike Fiedler <[email protected]> --------- Signed-off-by: Mike Fiedler <[email protected]>
1 parent 6b5f6bf commit 55ccaf7

File tree

5 files changed

+35
-33
lines changed

5 files changed

+35
-33
lines changed

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12.4
1+
3.12.6

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ version: 2
88
build:
99
os: ubuntu-22.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212
commands:
1313
- ./bin/rtd-docs

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN NODE_ENV=production npm run build
3636

3737

3838
# We'll build a light-weight layer along the way with just docs stuff
39-
FROM python:3.12.4-slim-bookworm AS docs
39+
FROM python:3.12.6-slim-bookworm AS docs
4040

4141
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
4242
# is good, but in our case, we're going to mount a special cache volume (kept between
@@ -105,7 +105,7 @@ USER docs
105105

106106
# Now we're going to build our actual application, but not the actual production
107107
# image that it gets deployed into.
108-
FROM python:3.12.4-slim-bookworm AS build
108+
FROM python:3.12.6-slim-bookworm AS build
109109

110110
# Define whether we're building a production or a development image. This will
111111
# generally be used to control whether or not we install our development and
@@ -189,7 +189,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
189189

190190
# Now we're going to build our actual application image, which will eventually
191191
# pull in the static files that were built above.
192-
FROM python:3.12.4-slim-bookworm
192+
FROM python:3.12.6-slim-bookworm
193193

194194
# Setup some basic environment variables that are ~never going to change.
195195
ENV PYTHONUNBUFFERED 1

tests/unit/rss/test_views.py

+30-26
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import datetime
1414

1515
import pretend
16+
import pytest
1617

1718
from warehouse.rss import views as rss
1819

@@ -102,36 +103,39 @@ def test_rss_project_releases(db_request):
102103
assert db_request.response.content_type == "text/xml"
103104

104105

105-
def test_format_author(db_request):
106+
@pytest.mark.parametrize(
107+
("author_email", "expected"),
108+
[
109+
(None, None),
110+
("", None),
111+
("UNKNOWN", None),
112+
("[email protected], UNKNOWN", None),
113+
114+
115+
(
116+
(
117+
# simple, no spaces
118+
119+
# space after
120+
121+
# space before, incl realname
122+
" No Reply <[email protected]>,"
123+
# two spaces before, angle brackets
124+
125+
),
126+
", ".join(["[email protected]"] * 4),
127+
),
128+
],
129+
)
130+
def test_format_author(db_request, author_email, expected):
106131
db_request.find_service = pretend.call_recorder(
107132
lambda *args, **kwargs: pretend.stub(
108133
enabled=False, csp_policy=pretend.stub(), merge=lambda _: None
109134
)
110135
)
111-
112136
db_request.session = pretend.stub()
113137

114-
project = ProjectFactory.create()
115-
release = ReleaseFactory.create(project=project)
116-
117-
release.author_email = "[email protected]"
118-
assert rss._format_author(release) == release.author_email
119-
120-
release.author_email = "No Reply <[email protected]>"
121-
assert rss._format_author(release) == "[email protected]"
122-
123-
for invalid in (None, "", "UNKNOWN", "[email protected], UNKNOWN"):
124-
release.author_email = invalid
125-
assert rss._format_author(release) is None
126-
127-
release.author_email = (
128-
# simple, no spaces
129-
130-
# space after
131-
132-
# space before, incl realname
133-
" No Reply <[email protected]>,"
134-
# two spaces before, angle brackets
135-
136-
)
137-
assert rss._format_author(release) == ", ".join(["[email protected]"] * 4)
138+
release = ReleaseFactory.create()
139+
140+
release.author_email = author_email
141+
assert rss._format_author(release) == expected

warehouse/rss/views.py

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def _format_author(release):
4040
return None
4141
author_emails.append(author_email)
4242

43-
if not author_emails:
44-
return None
4543
return ", ".join(author_emails)
4644

4745

0 commit comments

Comments
 (0)