Reset aiohttp route cache

This commit is contained in:
Erik
2025-04-30 15:17:16 +02:00
parent 2396fe2245
commit 71af693569

View File

@@ -21,7 +21,7 @@ import threading
from typing import TYPE_CHECKING, Any, cast from typing import TYPE_CHECKING, Any, cast
from unittest.mock import AsyncMock, MagicMock, Mock, _patch, patch from unittest.mock import AsyncMock, MagicMock, Mock, _patch, patch
from aiohttp import client from aiohttp import client, web_app
from aiohttp.resolver import AsyncResolver from aiohttp.resolver import AsyncResolver
from aiohttp.test_utils import ( from aiohttp.test_utils import (
BaseTestServer, BaseTestServer,
@@ -469,6 +469,9 @@ def reset_globals() -> Generator[None]:
frame.async_setup(None) frame.async_setup(None)
frame._REPORTED_INTEGRATIONS.clear() frame._REPORTED_INTEGRATIONS.clear()
# Reset the aiohttp cache
web_app._cached_build_middleware.cache_clear()
# Reset patch_json # Reset patch_json
if patch_json.mock_objects: if patch_json.mock_objects:
obj = patch_json.mock_objects.pop() obj = patch_json.mock_objects.pop()