Add basic migrations, query expression resolver
This commit is contained in:
parent
afe05fb7dd
commit
0990c2e1b4
15 changed files with 752 additions and 88 deletions
31
tests/conftest.py
Normal file
31
tests/conftest.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import pytest
|
||||
from redis import Redis
|
||||
|
||||
from redis_developer.connections import get_redis_connection
|
||||
from redis_developer.orm.migrations.migrator import Migrator
|
||||
|
||||
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
def migrations():
|
||||
Migrator().run()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def redis():
|
||||
yield get_redis_connection()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def key_prefix():
|
||||
# TODO
|
||||
yield "redis-developer"
|
||||
|
||||
|
||||
def _delete_test_keys(prefix: str, conn: Redis):
|
||||
for key in conn.scan_iter(f"{prefix}:*"):
|
||||
conn.delete(key)
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def delete_test_keys(redis, request, key_prefix):
|
||||
_delete_test_keys(key_prefix, redis)
|
Loading…
Add table
Add a link
Reference in a new issue