Skip to content

Commit

Permalink
Fixed test breakage on Python 3.11 and PyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed May 3, 2022
1 parent 2ba60ce commit 06fc3b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import pytest
import websockets
from aiohttp.abc import Request
from aiohttp.web_middlewares import middleware
from asphalt.core import Component, Context, inject, require_resource, resource
from httpx import AsyncClient

Expand Down Expand Up @@ -54,6 +52,9 @@ async def start(self, ctx: Context) -> None:


def setup_text_replacer(app, *, text: str, replacement: str) -> None:
from aiohttp.abc import Request
from aiohttp.web_middlewares import middleware

@middleware
async def text_replacer(request: Request, handler) -> None:
response = await handler(request)
Expand Down Expand Up @@ -139,7 +140,9 @@ async def test_aiohttp_ws(unused_tcp_port: int):
async def test_aiohttp_middleware(unused_tcp_port: int, method: str):
pytest.importorskip("aiohttp", reason="aiohttp not available")

from aiohttp.abc import Request
from aiohttp.web_app import Application
from aiohttp.web_middlewares import middleware

from asphalt.web.aiohttp import AIOHTTPComponent

Expand Down
3 changes: 2 additions & 1 deletion tests/test_django.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import pytest
from asgiref.typing import ASGI3Application
from asphalt.core import Context
from django.core.handlers.asgi import ASGIHandler
from httpx import AsyncClient


@pytest.mark.asyncio
async def test_django_http(unused_tcp_port: int):
pytest.importorskip("django", reason="Django not available")

from django.core.handlers.asgi import ASGIHandler

from asphalt.web.django import DjangoComponent

from .django_app.asgi import application
Expand Down

0 comments on commit 06fc3b9

Please sign in to comment.