Skip to content

Commit

Permalink
Update docker build and workflows to Python 3.11 (#373)
Browse files Browse the repository at this point in the history
* Update docker build and workflows to Python 3.11

* Add changelog and fix test
  • Loading branch information
MatMaul authored May 15, 2024
1 parent c025ac1 commit f308a28
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
ref: ${{github.event.pull_request.head.sha}}
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- run: python -m pip install towncrier
- run: "scripts-dev/check_newsfragment.sh ${{ github.event.number }}"
6 changes: 3 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- run: python -m pip install tox
- run: tox -e check_codestyle

Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- run: python -m pip install tox
- run: tox -e check_types

Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- run: python -m pip install -e .
- run: python -m twisted.trial tests

Expand Down
1 change: 1 addition & 0 deletions changelog.d/373.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update docker build and CI workflows to Python 3.11.
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
###
### Stage 0: builder
###
FROM python:3.10-slim as builder
FROM python:3.11-slim as builder

# Install git; Sygnal uses it to obtain the package version from the state of the
# git repository.
Expand All @@ -25,7 +25,7 @@ RUN pip install --prefix="/install" --no-warn-script-location /sygnal
### Stage 1: runtime
###

FROM python:3.10-slim
FROM python:3.11-slim
COPY --from=builder /install /usr/local

EXPOSE 5000/tcp
Expand Down
11 changes: 8 additions & 3 deletions tests/asyncio_test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import types
from asyncio import AbstractEventLoop, transports
from asyncio.protocols import BaseProtocol, Protocol
from asyncio.protocols import BaseProtocol, BufferedProtocol, Protocol
from asyncio.transports import Transport
from contextvars import Context
from typing import Any, Callable, List, Optional, Tuple
Expand Down Expand Up @@ -164,8 +164,13 @@ def abort(self) -> None:

def pretend_to_receive(self, data: bytes) -> None:
proto = self.get_protocol()
assert isinstance(proto, Protocol)
proto.data_received(data)
if isinstance(proto, Protocol):
proto.data_received(data)
elif isinstance(proto, BufferedProtocol):
data_len = len(data)
b = proto.get_buffer(data_len)
b[0:data_len] = data # type: ignore[index]
proto.buffer_updated(data_len)

def set_protocol(self, protocol: BaseProtocol) -> None:
self.protocol = protocol
Expand Down

0 comments on commit f308a28

Please sign in to comment.