update dependencies and python to 3.12.3 (#95)

* update dependencies and python to 3.12.3

* fix tests
This commit is contained in:
Dmitry Afanasyev
2024-04-20 19:16:37 +03:00
committed by GitHub
parent 3e7bbb6f60
commit b6a0427b1b
8 changed files with 561 additions and 356 deletions

View File

@@ -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