@@ -81,22 +81,33 @@ async def uncached_func(x):
8181 return x
8282
8383
84- ids = ["func-bounded" , "func-unbounded" , "meth-bounded" , "meth-unbounded" ]
85- funcs = [
86- cached_func ,
87- cached_func_unbounded ,
88- Methods .cached_meth ,
89- Methods .cached_meth_unbounded ,
90- ]
9184funcs_ttl = [
9285 cached_func_ttl ,
9386 cached_func_unbounded_ttl ,
9487 Methods .cached_meth_ttl ,
9588 Methods .cached_meth_unbounded_ttl ,
9689]
90+ all_funcs = [
91+ cached_func ,
92+ cached_func_unbounded ,
93+ Methods .cached_meth ,
94+ Methods .cached_meth_unbounded ,
95+ * funcs_ttl
96+ ]
97+
98+ ids = [
99+ "func-bounded" ,
100+ "func-unbounded" ,
101+ "meth-bounded" ,
102+ "meth-unbounded" ,
103+ "func-bounded-ttl" ,
104+ "func-unbounded-ttl" ,
105+ "meth-bounded-ttl" ,
106+ "meth-unbounded-ttl" ,
107+ ]
97108
98109
99- @pytest .mark .parametrize ("func" , funcs , ids = ids )
110+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
100111def test_cache_hit_benchmark (
101112 benchmark : BenchmarkFixture ,
102113 run_loop : Callable [..., Any ],
@@ -115,7 +126,7 @@ async def run() -> None:
115126 benchmark (run_loop , run )
116127
117128
118- @pytest .mark .parametrize ("func" , funcs , ids = ids )
129+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
119130def test_cache_miss_benchmark (
120131 benchmark : BenchmarkFixture ,
121132 run_loop : Callable [..., Any ],
@@ -131,7 +142,7 @@ async def run() -> None:
131142 benchmark (run_loop , run )
132143
133144
134- @pytest .mark .parametrize ("func" , funcs , ids = ids )
145+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
135146def test_cache_clear_benchmark (
136147 benchmark : BenchmarkFixture ,
137148 run_loop : Callable [..., Any ],
@@ -155,7 +166,7 @@ def test_cache_ttl_expiry_benchmark(
155166 benchmark (run_loop , func_ttl , 99 )
156167
157168
158- @pytest .mark .parametrize ("func" , funcs , ids = ids )
169+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
159170def test_cache_invalidate_benchmark (
160171 benchmark : BenchmarkFixture ,
161172 run_loop : Callable [..., Any ],
@@ -174,7 +185,7 @@ def run() -> None:
174185 invalidate (i )
175186
176187
177- @pytest .mark .parametrize ("func" , funcs , ids = ids )
188+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
178189def test_cache_info_benchmark (
179190 benchmark : BenchmarkFixture ,
180191 run_loop : Callable [..., Any ],
@@ -193,7 +204,7 @@ def run() -> None:
193204 cache_info ()
194205
195206
196- @pytest .mark .parametrize ("func" , funcs , ids = ids )
207+ @pytest .mark .parametrize ("func" , all_funcs , ids = ids )
197208def test_concurrent_cache_hit_benchmark (
198209 benchmark : BenchmarkFixture ,
199210 run_loop : Callable [..., Any ],
@@ -236,8 +247,8 @@ async def fill():
236247
237248# The relevant internal methods do not exist on _LRUCacheWrapperInstanceMethod,
238249# so we can skip methods for this part of the benchmark suite.
239- only_funcs = funcs [:2 ]
240- func_ids = ids [:2 ]
250+ only_funcs = funcs [:2 ] + funcs [ 4 : 5 ]
251+ func_ids = ids [:2 ] + ids [ 4 : 5 ]
241252
242253
243254@pytest .mark .parametrize ("func" , only_funcs , ids = func_ids )
0 commit comments