2023-03-14 01:27:22 +00:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
import pytest_asyncio
|
|
|
|
|
|
|
|
from core.config import config
|
2023-03-25 03:17:38 +00:00
|
|
|
from core.dependence.database import Database
|
2023-03-14 01:27:22 +00:00
|
|
|
from core.dependence.redisdb import RedisDB
|
|
|
|
|
|
|
|
|
|
|
|
@pytest_asyncio.fixture(scope="session")
|
|
|
|
def event_loop():
|
|
|
|
policy = asyncio.get_event_loop_policy()
|
|
|
|
res = policy.new_event_loop()
|
|
|
|
asyncio.set_event_loop(res)
|
|
|
|
yield res
|
|
|
|
res.close()
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
2023-03-25 03:17:38 +00:00
|
|
|
def database():
|
|
|
|
return Database.from_config(config=config)
|
2023-03-14 01:27:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def redis():
|
|
|
|
return RedisDB.from_config(config=config)
|