From 0cee6feeb002f91d6c894cee16a564d86ddaaa51 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Fri, 27 Feb 2026 17:31:56 -0500 Subject: AsyncGenerator type checking and model imports to http fixtures. --- tests/fixtures/http.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/fixtures/http.py b/tests/fixtures/http.py index 4f11fde..5f50580 100644 --- a/tests/fixtures/http.py +++ b/tests/fixtures/http.py @@ -4,7 +4,7 @@ import pytest import requests_mock from asgi_lifespan import LifespanManager from httpx import AsyncClient, ASGITransport -from typing import Dict, Any +from typing import Dict, Any, AsyncGenerator from jb.main import app import json @@ -12,6 +12,8 @@ import json from httpx import AsyncClient import secrets +from jb.models.hit import Hit +from jb.models.assignment import AssignmentStub from jb.config import JB_EVENTS_STREAM, settings from tests import generate_amt_id @@ -22,7 +24,7 @@ def anyio_backend(): @pytest.fixture(scope="session") -async def httpxclient(): +async def httpxclient() -> AsyncGenerator[AsyncClient, None]: # limiter.enabled = True # limiter.reset() app.testing = True @@ -46,11 +48,11 @@ def no_limit(): @pytest.fixture() -def httpxclient_ip(httpxclient): +def httpxclient_ip(httpxclient: AsyncClient): """Fixture to execute asserts before and after a test is run""" - httpxclient._transport = httpx.ASGITransport(app=app, client=("1.2.3.4", 8001)) + httpxclient._transport = httpx.ASGITransport(app=app, client=("1.2.3.4", 8001)) # type: ignore[attr-defined] yield httpxclient # this is where the testing happens - httpxclient._transport = httpx.ASGITransport(app=app) + httpxclient._transport = httpx.ASGITransport(app=app) # type: ignore[attr-defined] @pytest.fixture -- cgit v1.2.3