Skip to content

Commit 1675272

Browse files
committed
fix conftest
(cherry picked from commit d924df5)
1 parent 8d4f656 commit 1675272

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22

33
import pytest
44
import pytest_asyncio
5+
6+
from asgiref.compatibility import iscoroutinefunction
57
from django.core.cache import cache as default_cache
68

79
from django_valkey.base import BaseValkeyCache
810

911

1012
# for some reason `isawaitable` doesn't work here
11-
try:
13+
if iscoroutinefunction(default_cache.clear):
1214

1315
@pytest_asyncio.fixture(loop_scope="session")
1416
async def cache():
1517
yield default_cache
1618
await default_cache.aclear()
1719

18-
except Exception:
20+
else:
1921

2022
@pytest.fixture
2123
def cache() -> Iterable[BaseValkeyCache]:

0 commit comments

Comments
 (0)