From c7c33754c38e8178c896ab91be52cba66bf88744 Mon Sep 17 00:00:00 2001 From: Abram Date: Fri, 13 Dec 2024 14:09:58 +0100 Subject: [PATCH] refactor (tests): extend event_loop fixture in oss to work with cloud --- agenta-backend/agenta_backend/tests/conftest.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/agenta-backend/agenta_backend/tests/conftest.py b/agenta-backend/agenta_backend/tests/conftest.py index 36866f2d45..22f08588aa 100644 --- a/agenta-backend/agenta_backend/tests/conftest.py +++ b/agenta-backend/agenta_backend/tests/conftest.py @@ -1,7 +1,10 @@ import pytest import asyncio -from agenta_backend.tests.engine import test_db_engine as db_engine +from agenta_backend.utils.common import isOss + +if isOss(): + from agenta_backend.tests.engine import test_db_engine as db_engine @pytest.fixture(scope="session", autouse=True) @@ -17,6 +20,8 @@ def event_loop(): yield res - res.run_until_complete(db_engine.remove_db()) # drop database - res.run_until_complete(db_engine.close_db()) # close connections to database + if isOss(): + res.run_until_complete(db_engine.remove_db()) # drop database + res.run_until_complete(db_engine.close_db()) # close connections to database + res._close() # close event loop # type: ignore