Fixture that resets the internal state of the cache result backend.
(celery_app)
| 94 | |
| 95 | @pytest.fixture(autouse=True) |
| 96 | def reset_cache_backend_state(celery_app): |
| 97 | """Fixture that resets the internal state of the cache result backend.""" |
| 98 | yield |
| 99 | backend = celery_app.__dict__.get('backend') |
| 100 | if backend is not None: |
| 101 | if isinstance(backend, CacheBackend): |
| 102 | if isinstance(backend.client, DummyClient): |
| 103 | backend.client.cache.clear() |
| 104 | backend._cache.clear() |
| 105 | |
| 106 | |
| 107 | @contextmanager |