File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class MemoryBackend(CacheBackend):
5050 """
5151
5252 def __init__ (self , arguments ):
53- self ._cache = arguments .pop ("cache_dict" , {})
53+ self ._cache = arguments .get ("cache_dict" , {})
5454
5555 def get (self , key ):
5656 return self ._cache .get (key , NO_VALUE )
Original file line number Diff line number Diff line change @@ -32,7 +32,14 @@ def setup_class(cls):
3232 backend_cls = _backend_loader .load (cls .backend )
3333 try :
3434 arguments = cls .config_args .get ("arguments" , {})
35+ stashed = arguments .copy ()
3536 backend = backend_cls (arguments )
37+ # Fail the test if the parameters have been altered by the backend setup;
38+ # the test results in such cases should be considered suspect
39+ if arguments != stashed :
40+ raise ValueError (
41+ f"Backend setup failure, test parameters have been altered: { arguments } != { stashed } "
42+ )
3643 except ImportError :
3744 pytest .skip ("Backend %s not installed" % cls .backend )
3845 cls ._check_backend_available (backend )
Original file line number Diff line number Diff line change 44
55class MemoryBackendTest (_GenericBackendTestSuite ):
66 backend = "dogpile.cache.memory"
7+ config_args = {"arguments" : {"cache_dict" : {"cache" : "warm" }}}
78
89
910class MemoryBackendSerializerTest (
You can’t perform that action at this time.
0 commit comments