From 71af693569dc7717a1c2c7b39f956e27a73dc37a Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 30 Apr 2025 15:17:16 +0200 Subject: [PATCH] Reset aiohttp route cache --- tests/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 89e5361486e..1822254ddd0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,7 +21,7 @@ import threading from typing import TYPE_CHECKING, Any, cast 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.test_utils import ( BaseTestServer, @@ -469,6 +469,9 @@ def reset_globals() -> Generator[None]: frame.async_setup(None) frame._REPORTED_INTEGRATIONS.clear() + # Reset the aiohttp cache + web_app._cached_build_middleware.cache_clear() + # Reset patch_json if patch_json.mock_objects: obj = patch_json.mock_objects.pop()