题意:
“对于有选择性的 Django pytest,使用 LocMemCache。”
问题背景:
I have a custom Throttling classes based on Django REST framework's SimpleRateThrottle and I would like to test my custom class with pytest. Since my default test settings uses DummyCache, I would like to switch to LocMemCache for just this particular test module(SimpleRateThrottle uses cache backend to track counts). Is there a way to switch the cache backend for just selective tests? Setting settings.CACHE in a fixture doesn't seem to work. I also tried mocking the default_cache inside the SimpleRateThrottle, but I couldn't