From 5f1ee7ad9cda72d650abdc225c84f52a5d443c3f Mon Sep 17 00:00:00 2001 From: collerek Date: Mon, 7 Dec 2020 13:04:50 +0100 Subject: [PATCH] fix unknown engine param in test for other backends --- tests/test_saving_related.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_saving_related.py b/tests/test_saving_related.py index 4967ec6..0676a26 100644 --- a/tests/test_saving_related.py +++ b/tests/test_saving_related.py @@ -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()