Created
September 15, 2016 09:39
-
-
Save zsoldosp/7a77f3f5ff21d60db0cd2bd4285f00c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
from django.core.cache import caches | |
@pytest.fixture() | |
def django_caches(): | |
yield caches | |
# finalizer | |
for cache in caches.all(): | |
cache.clear() | |
@pytest.mark.parametrize('i', [1, 2]) | |
def test_caches_fixture_provides_an_empty_cache(django_caches, i): | |
key = 'foo' | |
for cache in django_caches.all(): | |
assert key not in cache | |
cache.set(key=key, value=i) | |
assert key in cache | |
assert cache.get(key) == i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment