fix unknown engine param in test for other backends

This commit is contained in:
collerek
2020-12-07 13:04:50 +01:00
parent 594542a7f8
commit 5f1ee7ad9c

View File

@ -1,13 +1,13 @@
from typing import Union
import databases
import ormar
import pytest
import sqlalchemy as sa
from sqlalchemy import create_engine
import ormar
from tests.settings import DATABASE_URL
engine = sa.create_engine(DATABASE_URL, connect_args={"check_same_thread": False})
metadata = sa.MetaData()
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():
engine = create_engine(DATABASE_URL)
metadata.create_all(engine)
yield
metadata.drop_all(engine)
@pytest.mark.asyncio
async def test_model_relationship(create_test_database):
async def test_model_relationship():
cat = await Category(name="Foo", code=123).save()
ws = await Workshop(topic="Topic 1", category=cat).save()