async def initialize(cls) -> None: """ Sets up the global DB for testing. Must be called as part of test environment setup. """ Tortoise.init(cls.get_db_config()) await Tortoise.open_connections(create_db=True) await Tortoise.generate_schemas(safe=False) await Tortoise.close_connections() cls.tortoise_test._inited = Tortoise._inited cls.tortoise_test._app_models_map = Tortoise._app_models_map.copy() cls.tortoise_test._db_client_map = Tortoise._db_client_map.copy() cls.tortoise_test._current_transaction_map = Tortoise._current_transaction_map.copy() Tortoise._reset()
def tearDown(self) -> None: Tortoise._reset()
async def asyncTearDown(self): await Tortoise.close_connections() Tortoise._reset()
async def asyncTearDown(self) -> None: Tortoise._reset()