We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d4f656 commit 1675272Copy full SHA for 1675272
tests/conftest.py
@@ -2,20 +2,22 @@
2
3
import pytest
4
import pytest_asyncio
5
+
6
+from asgiref.compatibility import iscoroutinefunction
7
from django.core.cache import cache as default_cache
8
9
from django_valkey.base import BaseValkeyCache
10
11
12
# for some reason `isawaitable` doesn't work here
-try:
13
+if iscoroutinefunction(default_cache.clear):
14
15
@pytest_asyncio.fixture(loop_scope="session")
16
async def cache():
17
yield default_cache
18
await default_cache.aclear()
19
-except Exception:
20
+else:
21
22
@pytest.fixture
23
def cache() -> Iterable[BaseValkeyCache]:
0 commit comments