File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66from async_lru import AlruCacheLoopResetWarning , alru_cache
77
8+
89@pytest .mark .filterwarnings ("ignore::async_lru.AlruCacheLoopResetWarning" )
910def test_cross_loop_auto_resets_cache () -> None :
1011 @alru_cache (maxsize = 100 )
@@ -49,6 +50,7 @@ async def cached_func(key: str) -> str:
4950 assert cached_func .cache_info ().hits == 0
5051 assert cached_func .cache_info ().misses == 1
5152
53+
5254@pytest .mark .filterwarnings ("ignore::async_lru.AlruCacheLoopResetWarning" )
5355def test_invalid_key_does_not_bind_loop () -> None :
5456 @alru_cache (maxsize = 100 )
@@ -142,6 +144,7 @@ async def run_concurrent() -> list[str]:
142144 assert results == ["data_test" ] * 3
143145 assert cached_func .cache_info ().hits == 2
144146
147+
145148@pytest .mark .filterwarnings ("ignore::async_lru.AlruCacheLoopResetWarning" )
146149def test_multiple_loop_transitions () -> None :
147150 @alru_cache (maxsize = 100 )
@@ -190,8 +193,6 @@ async def cached_func(key: str) -> str:
190193 all_warnings .extend (w )
191194
192195 reset_warnings = [
193- w for w in all_warnings
194- if issubclass (w .category , AlruCacheLoopResetWarning )
196+ w for w in all_warnings if issubclass (w .category , AlruCacheLoopResetWarning )
195197 ]
196198 assert len (reset_warnings ) == 1
197-
You can’t perform that action at this time.
0 commit comments