From 7a5a1eba78238b10c843082a594695239485c96a Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 7 Sep 2023 11:05:24 +0100 Subject: [PATCH] :art: Format - ran black and foramt-fix --- agenta-backend/agenta_backend/models/db_engine.py | 10 ++++++---- agenta-backend/tests/conftest.py | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/agenta-backend/agenta_backend/models/db_engine.py b/agenta-backend/agenta_backend/models/db_engine.py index a084d3deda..26a309d980 100644 --- a/agenta-backend/agenta_backend/models/db_engine.py +++ b/agenta-backend/agenta_backend/models/db_engine.py @@ -25,7 +25,7 @@ def initialize_client(self) -> AsyncIOMotorClient: Returns an instance of `AsyncIOMotorClient` initialized \ with the provided `db_url`. """ - + client = AsyncIOMotorClient(self.db_url) return client @@ -33,16 +33,18 @@ def engine(self) -> AIOEngine: """ Returns an AIOEngine object with a specified database name based on the mode. """ - + if self.mode == "test": - aio_engine = AIOEngine(client=self.initialize_client, database="agenta_test") + aio_engine = AIOEngine( + client=self.initialize_client, database="agenta_test" + ) logger.info("Using test database...") return aio_engine elif self.mode == "default": aio_engine = AIOEngine(client=self.initialize_client, database="agenta") logger.info("Using default database") return aio_engine - + def remove_db(self) -> None: client = MongoClient(self.db_url) if self.mode == "default": diff --git a/agenta-backend/tests/conftest.py b/agenta-backend/tests/conftest.py index e2fa4833af..e7c5de5b25 100644 --- a/agenta-backend/tests/conftest.py +++ b/agenta-backend/tests/conftest.py @@ -11,10 +11,11 @@ def test_app(): yield client # provide the test client to the tests # teardown code goes here + @pytest.fixture(scope="function") def test_db_engine(): # Initialize the DBEngine in 'test' mode db_engine = DBEngine(mode="test") test_engine = db_engine.engine() yield test_engine - db_engine.remove_db() \ No newline at end of file + db_engine.remove_db()