Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update Python 3.12.6 #16700

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.4
3.12.6
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
commands:
- ./bin/rtd-docs
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN NODE_ENV=production npm run build


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

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

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

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

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

# Setup some basic environment variables that are ~never going to change.
ENV PYTHONUNBUFFERED 1
Expand Down
56 changes: 30 additions & 26 deletions tests/unit/rss/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import datetime

import pretend
import pytest

from warehouse.rss import views as rss

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


def test_format_author(db_request):
@pytest.mark.parametrize(
("author_email", "expected"),
[
(None, None),
("", None),
("UNKNOWN", None),
("noreply@pypi.org, UNKNOWN", None),
("noreply@pypi.org", "noreply@pypi.org"),
("No Reply <noreply@pypi.org>", "noreply@pypi.org"),
(
(
# simple, no spaces
"noreply@pypi.org,"
# space after
"noreply@pypi.org ,"
# space before, incl realname
" No Reply <noreply@pypi.org>,"
# two spaces before, angle brackets
" <noreply@pypi.org>"
),
", ".join(["noreply@pypi.org"] * 4),
),
],
)
def test_format_author(db_request, author_email, expected):
db_request.find_service = pretend.call_recorder(
lambda *args, **kwargs: pretend.stub(
enabled=False, csp_policy=pretend.stub(), merge=lambda _: None
)
)

db_request.session = pretend.stub()

project = ProjectFactory.create()
release = ReleaseFactory.create(project=project)

release.author_email = "noreply@pypi.org"
assert rss._format_author(release) == release.author_email

release.author_email = "No Reply <noreply@pypi.org>"
assert rss._format_author(release) == "noreply@pypi.org"

for invalid in (None, "", "UNKNOWN", "noreply@pypi.org, UNKNOWN"):
release.author_email = invalid
assert rss._format_author(release) is None

release.author_email = (
# simple, no spaces
"noreply@pypi.org,"
# space after
"noreply@pypi.org ,"
# space before, incl realname
" No Reply <noreply@pypi.org>,"
# two spaces before, angle brackets
" <noreply@pypi.org>"
)
assert rss._format_author(release) == ", ".join(["noreply@pypi.org"] * 4)
release = ReleaseFactory.create()

release.author_email = author_email
assert rss._format_author(release) == expected
2 changes: 0 additions & 2 deletions warehouse/rss/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def _format_author(release):
return None
author_emails.append(author_email)

if not author_emails:
return None
return ", ".join(author_emails)


Expand Down