Skip to content

Commit

Permalink
3.12 (#50)
Browse files Browse the repository at this point in the history
* 3.12

* Clean up tests
  • Loading branch information
Tinche committed Nov 2, 2023
1 parent c00d46d commit d347001
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 108 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
redis-version: [6]

steps:
Expand All @@ -24,6 +24,7 @@ jobs:
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
allow-prereleases: true

- name: "Start Redis"
uses: "supercharge/redis-github-action@1.2.0"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The **third number** is for emergencies when we need to start branches for older
- OpenAPI summaries and descriptions are now supported, and can be overridden.
- `aiohttp.web.StreamResponse` is now handled as the root class of aiohttp responses.
- _uapi_ is now tested against Flask 3.
- _uapi_ is now tested against Python 3.12.

### Fixed

Expand Down
86 changes: 50 additions & 36 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Typing :: Typed",
]
Expand All @@ -36,7 +37,7 @@ test = [
"coverage",
"pytest-asyncio",
"httpx",
"aiohttp",
"aiohttp==3.9.0b0",
"flask",
"quart",
"starlette",
Expand Down
2 changes: 2 additions & 0 deletions src/uapi/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ async def run(
handle_signals: bool = True,
shutdown_timeout: float = 60,
access_log: Logger | None = access_logger,
print: Callable[..., None] | None = print,
):
app = Application()
app.add_routes(self.to_framework_routes())
Expand All @@ -278,6 +279,7 @@ async def run(
handle_signals=handle_signals,
shutdown_timeout=shutdown_timeout,
access_log=access_log,
print=print,
)


Expand Down
18 changes: 3 additions & 15 deletions tests/aiohttp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from aiohttp import web
from aiohttp.web import Request, Response

from uapi import ResponseException
Expand All @@ -15,6 +14,8 @@ class RespSubclass(Response):
def make_app() -> App:
app = App()

configure_base_async(app)

@app.get("/framework-request")
async def framework_request(req: Request) -> str:
return "framework_request" + req.headers["test"]
Expand All @@ -28,8 +29,6 @@ async def path_param(path_id: int) -> Response:

app.route("/path/{path_id}", path_param)

configure_base_async(app)

@app.options("/unannotated-exception")
async def unannotated_exception() -> Response:
raise ResponseException(NoContent())
Expand Down Expand Up @@ -61,16 +60,5 @@ async def post_path_string(path_id: str) -> str:
return app


async def run_server(port: int, openapi: bool = False):
app = make_app()
if openapi:
app.serve_openapi()
aapp = web.Application()
aapp.add_routes(app.to_framework_routes())
await web._run_app(aapp, port=port, handle_signals=False)


async def run_on_aiohttp(app: App, port: int):
aiohttp_app = web.Application()
aiohttp_app.add_routes(app.to_framework_routes())
await web._run_app(aiohttp_app, port=port, handle_signals=False)
await app.run(port, handle_signals=False, shutdown_timeout=0.0, access_log=None)
Loading

0 comments on commit d347001

Please sign in to comment.