You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using cache_region decorator, beaker will use the following snippet to determine if it should instantiate a new cache for each function that was decorated with it.
When cache[0] is None, the decorator generates the missing cache if the corresponding region was defined with enabled = true and stores it in that local list.
I have a situation where I'm running unit tests on an application where I want to evaluate different combinations of cache regions with enabled/disable states. The problem with that local list storing the enabled cache is that if one test case later that must have it disabled, the if not cache[0]: check completely bypasses whichever new settings I set via cache_regions, since the cache is already created.
Also, since the Cache reference is stored in that local list (rather than global/package one), I cannot even wipe it.
Calling cache_managers.clear(), which has the same reference to that local cache added from the following lines will NOT clear cache[0].
When using
cache_region
decorator, beaker will use the following snippet to determine if it should instantiate a new cache for each function that was decorated with it.beaker/beaker/cache.py
Lines 545 to 570 in 889d305
When
cache[0]
isNone
, the decorator generates the missing cache if the corresponding region was defined withenabled = true
and stores it in that local list.I have a situation where I'm running unit tests on an application where I want to evaluate different combinations of cache regions with enabled/disable states. The problem with that local list storing the enabled cache is that if one test case later that must have it disabled, the
if not cache[0]:
check completely bypasses whichever new settings I set viacache_regions
, since the cache is already created.Also, since the
Cache
reference is stored in that local list (rather than global/package one), I cannot even wipe it.Calling
cache_managers.clear()
, which has the same reference to that local cache added from the following lines will NOT clearcache[0]
.beaker/beaker/cache.py
Lines 308 to 314 in 889d305
Is there a way to avoid this?
I struggle trying to monkey-patch the cache object in
cache[0]
for my test cases.The text was updated successfully, but these errors were encountered: