fix unknown engine param in test for other backends
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import databases
|
import databases
|
||||||
import ormar
|
|
||||||
import pytest
|
import pytest
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
|
||||||
|
import ormar
|
||||||
from tests.settings import DATABASE_URL
|
from tests.settings import DATABASE_URL
|
||||||
|
|
||||||
engine = sa.create_engine(DATABASE_URL, connect_args={"check_same_thread": False})
|
|
||||||
metadata = sa.MetaData()
|
metadata = sa.MetaData()
|
||||||
db = databases.Database(DATABASE_URL)
|
db = databases.Database(DATABASE_URL)
|
||||||
|
|
||||||
@ -36,15 +36,16 @@ class Workshop(ormar.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture(autouse=True, scope="module")
|
||||||
def create_test_database():
|
def create_test_database():
|
||||||
|
engine = create_engine(DATABASE_URL)
|
||||||
metadata.create_all(engine)
|
metadata.create_all(engine)
|
||||||
yield
|
yield
|
||||||
metadata.drop_all(engine)
|
metadata.drop_all(engine)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_model_relationship(create_test_database):
|
async def test_model_relationship():
|
||||||
cat = await Category(name="Foo", code=123).save()
|
cat = await Category(name="Foo", code=123).save()
|
||||||
ws = await Workshop(topic="Topic 1", category=cat).save()
|
ws = await Workshop(topic="Topic 1", category=cat).save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user