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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 561 additions and 356 deletions

View File

@ -23,7 +23,7 @@ jobs:
id: setup-python id: setup-python
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: '3.12.2' python-version: '3.12.3'
#---------------------------------------------- #----------------------------------------------
# ----- install & configure poetry ----- # ----- install & configure poetry -----
#---------------------------------------------- #----------------------------------------------

View File

@ -26,7 +26,7 @@ jobs:
id: setup-python id: setup-python
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: '3.12.2' python-version: '3.12.3'
#---------------------------------------------- #----------------------------------------------
# ----- install & configure poetry ----- # ----- install & configure poetry -----
#---------------------------------------------- #----------------------------------------------

View File

@ -70,7 +70,7 @@ async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
async def bug_report(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: async def bug_report(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Send a message when the command /bug-report is issued.""" """Send a message when the command /bug-report is issued."""
if not update.effective_message: if not update.effective_message or not settings.ADMIN_CHAT_ID:
return return
async with get_bot(settings.TELEGRAM_API_TOKEN) as bot: async with get_bot(settings.TELEGRAM_API_TOKEN) as bot:
await bot.send_message(chat_id=settings.ADMIN_CHAT_ID, text=f"Bug report from user: {update.effective_user}") await bot.send_message(chat_id=settings.ADMIN_CHAT_ID, text=f"Bug report from user: {update.effective_user}")

View File

@ -12,6 +12,7 @@ TELEGRAM_API_TOKEN="123456789:AABBCCDDEEFFaabbccddeeff-1234567890"
START_WITH_WEBHOOK="false" START_WITH_WEBHOOK="false"
SUPERUSER="Superuser" SUPERUSER="Superuser"
ADMIN_CHAT_ID="123456789"
# ==== domain settings ==== # ==== domain settings ====
DOMAIN="http://localhost" DOMAIN="http://localhost"

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 # 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. # session. See https://github.com/pytest-dev/pytest-asyncio/issues/68 for more details.
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
def event_loop() -> AbstractEventLoop: async def event_loop() -> AsyncGenerator[AbstractEventLoop, None]:
""" """
Пересоздаем луп для изоляции тестов. В основном нужно для запуска юнит тестов Пересоздаем луп для изоляции тестов. В основном нужно для запуска юнит тестов
в связке с интеграционными, т.к. без этого pytest зависает. в связке с интеграционными, т.к. без этого pytest зависает.
@ -35,7 +35,10 @@ def event_loop() -> AbstractEventLoop:
""" """
loop = asyncio.get_event_loop_policy().new_event_loop() loop = asyncio.get_event_loop_policy().new_event_loop()
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
return loop try:
yield loop
finally:
loop.close()
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
@ -186,7 +189,7 @@ async def main_application(
await database.drop_database() await database.drop_database()
@pytest.fixture() @pytest.fixture
async def rest_client(main_application: AppApplication) -> AsyncGenerator[AsyncClient, None]: async def rest_client(main_application: AppApplication) -> AsyncGenerator[AsyncClient, None]:
""" """
Default http client. Use to test unauthorized requests, public endpoints Default http client. Use to test unauthorized requests, public endpoints

View File

@ -1,4 +1,4 @@
FROM python:3.12.2 AS compile-image FROM python:3.12.3 AS compile-image
ARG USER=web ARG USER=web
ARG STAGE ARG STAGE

878
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -12,19 +12,19 @@ build-backend = "poetry.core.masonry.api"
python = "^3.12" python = "^3.12"
fastapi = "^0.110" fastapi = "^0.110"
python-telegram-bot = {version = "^21.0", extras=["ext"]} python-telegram-bot = {version = "^21.1", extras=["ext"]}
python-dotenv = "^1.0" python-dotenv = "^1.0"
python-dateutil = "*" python-dateutil = "*"
httpx = "^0.27" httpx = "^0.27"
aiohttp = "^3.9" aiohttp = "^3.9"
loguru = "^0.7" loguru = "^0.7"
pydantic = "^2.6" pydantic = "^2.7"
pydantic-settings = "^2.2" pydantic-settings = "^2.2"
gunicorn = "^21.2" gunicorn = "^22.0"
uvicorn = "^0.29" uvicorn = "^0.29"
wheel = "^0.43" wheel = "^0.43"
orjson = "^3.10" orjson = "^3.10"
sentry-sdk = "^1.44" sentry-sdk = "^1.45"
SpeechRecognition = "^3.8" SpeechRecognition = "^3.8"
greenlet = "^3.0" greenlet = "^3.0"
graypy = "^2.1.0" graypy = "^2.1.0"
@ -34,7 +34,7 @@ sqlalchemy = {version = "^2.0", extras=["mypy"]}
alembic = "^1.13" alembic = "^1.13"
sqladmin = {version = "^0.16", extras=["full"]} sqladmin = {version = "^0.16", extras=["full"]}
pydub = {git = "https://github.com/jiaaro/pydub.git"} pydub = {git = "https://github.com/jiaaro/pydub.git"}
types-pytz = "^2024.1.0.20240203" types-pytz = "^2024.1.0.20240417"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
@ -43,7 +43,7 @@ ipython = "^8.23"
factory-boy = "^3.3" factory-boy = "^3.3"
Faker = "^20" Faker = "^20"
safety = "^2.4.0b2" safety = "^3.1"
pip-audit = "^2.7" pip-audit = "^2.7"
yamllint = "^1.33" yamllint = "^1.33"
tomlkit = "^0.12" tomlkit = "^0.12"
@ -51,14 +51,14 @@ bandit = "^1.7"
pyupgrade = "^3.15" pyupgrade = "^3.15"
isort = "^5.12" isort = "^5.12"
black = "^24.3" black = "^24.4"
mypy = "^1.9" mypy = "^1.9"
types-PyMySQL = "^1.0" types-PyMySQL = "^1.0"
types-python-dateutil = "^2.9" types-python-dateutil = "^2.9"
pytest = "^8.1" pytest = "^8.1"
pytest-asyncio = "^0.15.1" pytest-asyncio = "^0.23"
pytest-deadfixtures = "^2.2" pytest-deadfixtures = "^2.2"
pytest-repeat = "^0.9" pytest-repeat = "^0.9"
pytest-mock = "^3.14" pytest-mock = "^3.14"
@ -90,7 +90,7 @@ flake8-comments = "^0.1.2"
flake8-logging-format = "^0.9" flake8-logging-format = "^0.9"
flake8-comprehensions = "^3.14" flake8-comprehensions = "^3.14"
flake8-eradicate = "^1.5" flake8-eradicate = "^1.5"
flake8-pytest-style = "^1.7" flake8-pytest-style = "^2.0"
flake8-bugbear = "^24.1" flake8-bugbear = "^24.1"
flake8-warnings = "^0.4" flake8-warnings = "^0.4"
flake8-debugger = "^4.1" flake8-debugger = "^4.1"
@ -99,7 +99,7 @@ flake8-simplify = "^0.21"
flake8-bandit = "^4.1" flake8-bandit = "^4.1"
Flake8-pyproject = "^1.2.3" Flake8-pyproject = "^1.2.3"
ruff = "^0.3" ruff = "^0.4"
[tool.flake8] [tool.flake8]
inline-quotes = "double" inline-quotes = "double"
@ -186,6 +186,7 @@ sort = "cover"
skip_covered = true skip_covered = true
[tool.pytest.ini_options] [tool.pytest.ini_options]
asyncio_mode = "auto"
minversion = "7.0" minversion = "7.0"
testpaths = "tests" testpaths = "tests"
python_files = [ python_files = [