mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2026-02-03 11:40:39 +03:00
update dependencies and python to 3.12.3 (#95)
* update dependencies and python to 3.12.3 * fix tests
This commit is contained in:
@@ -27,7 +27,7 @@ def test_settings() -> AppSettings:
|
||||
# Redefine the event_loop fixture to have a session scope. Otherwise `bot` fixture can't be
|
||||
# session. See https://github.com/pytest-dev/pytest-asyncio/issues/68 for more details.
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def event_loop() -> AbstractEventLoop:
|
||||
async def event_loop() -> AsyncGenerator[AbstractEventLoop, None]:
|
||||
"""
|
||||
Пересоздаем луп для изоляции тестов. В основном нужно для запуска юнит тестов
|
||||
в связке с интеграционными, т.к. без этого pytest зависает.
|
||||
@@ -35,7 +35,10 @@ def event_loop() -> AbstractEventLoop:
|
||||
"""
|
||||
loop = asyncio.get_event_loop_policy().new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
return loop
|
||||
try:
|
||||
yield loop
|
||||
finally:
|
||||
loop.close()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@@ -186,7 +189,7 @@ async def main_application(
|
||||
await database.drop_database()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
async def rest_client(main_application: AppApplication) -> AsyncGenerator[AsyncClient, None]:
|
||||
"""
|
||||
Default http client. Use to test unauthorized requests, public endpoints
|
||||
|
||||
Reference in New Issue
Block a user