Migrate from aioredis to redis-py with asyncio support (#233)
* Migrate from aioredis to redis with asyncio support Add test for redis type Fix imports from wrong module (for tests_sync) * fixing merge conflicts and up to dating the lock file Co-authored-by: Chayim I. Kirshen <c@kirshen.com>
This commit is contained in:
parent
e5e887229a
commit
4661459ddd
15 changed files with 484 additions and 494 deletions
|
@ -23,7 +23,9 @@ from aredis_om import (
|
|||
# We need to run this check as sync code (during tests) even in async mode
|
||||
# because we call it in the top-level module scope.
|
||||
from redis_om import has_redisearch
|
||||
from tests.conftest import py_test_mark_asyncio
|
||||
|
||||
from .conftest import py_test_mark_asyncio
|
||||
|
||||
|
||||
if not has_redisearch():
|
||||
pytestmark = pytest.mark.skip
|
||||
|
|
|
@ -25,7 +25,9 @@ from aredis_om import (
|
|||
# We need to run this check as sync code (during tests) even in async mode
|
||||
# because we call it in the top-level module scope.
|
||||
from redis_om import has_redis_json
|
||||
from tests.conftest import py_test_mark_asyncio
|
||||
|
||||
from .conftest import py_test_mark_asyncio
|
||||
|
||||
|
||||
if not has_redis_json():
|
||||
pytestmark = pytest.mark.skip
|
||||
|
|
|
@ -9,7 +9,8 @@ import pytest_asyncio
|
|||
from pydantic import ValidationError
|
||||
|
||||
from aredis_om import HashModel, Migrator, NotFoundError, RedisModelError
|
||||
from tests.conftest import py_test_mark_asyncio
|
||||
|
||||
from .conftest import py_test_mark_asyncio
|
||||
|
||||
|
||||
today = datetime.date.today()
|
||||
|
|
10
tests/test_redis_type.py
Normal file
10
tests/test_redis_type.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from aredis_om import redis
|
||||
from aredis_om.util import ASYNC_MODE
|
||||
|
||||
|
||||
def test_redis_type():
|
||||
import redis as sync_redis_module
|
||||
import redis.asyncio as async_redis_module
|
||||
|
||||
mapping = {True: async_redis_module, False: sync_redis_module}
|
||||
assert mapping[ASYNC_MODE] is redis
|
Loading…
Add table
Add a link
Reference in a new issue