add some tests for db.find_ratings
This commit is contained in:
parent
a17b49bc0b
commit
e1f35143df
4 changed files with 195 additions and 8 deletions
30
tests/conftest.py
Normal file
30
tests/conftest.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import asyncio
|
||||
|
||||
import pytest
|
||||
from unwind import db
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def event_loop():
|
||||
loop = asyncio.new_event_loop()
|
||||
yield loop
|
||||
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||
loop.run_until_complete(loop.shutdown_default_executor())
|
||||
loop.close()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
async def shared_conn():
|
||||
c = db.shared_connection()
|
||||
await c.connect()
|
||||
|
||||
await db.apply_db_patches(c)
|
||||
yield c
|
||||
|
||||
await c.disconnect()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def conn(shared_conn):
|
||||
async with shared_conn.transaction(force_rollback=True):
|
||||
yield shared_conn
|
||||
Loading…
Add table
Add a link
Reference in a new issue