Completed
Push — master ( 95d8d5...80ebcd )
by Ionel Cristian
6s
created

test_django_works()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 4
rs 10
1
import pytest
2
3
try:
4
    import django
5
except ImportError:
6
    django = None
7
else:
8
    from django.core.cache import cache
9
10
11
@pytest.mark.skipif("not django")
12
def test_django_works(redis_server):
13
    with cache.lock('whateva'):
14
        pass
15
16
17
@pytest.mark.skipif("not django")
18
def test_reset_all(redis_server):
19
    lock1 = cache.lock("foobar1")
20
    lock2 = cache.lock("foobar2")
21
    lock1.acquire(blocking=False)
22
    lock2.acquire(blocking=False)
23
    cache.reset_all()
24
    lock1 = cache.lock("foobar1")
25
    lock2 = cache.lock("foobar2")
26
    lock1.acquire(blocking=False)
27
    lock2.acquire(blocking=False)
28
    lock1.release()
29
    lock2.release()
30