add pytest to sys PATH

This commit is contained in:
Dmitry Afanasyev 2022-08-15 00:27:16 +03:00
parent 6ad60f210f
commit 46aa577da8
3 changed files with 8 additions and 5 deletions

View File

@ -34,7 +34,6 @@ jobs:
curl -sSL "https://install.python-poetry.org" | python - curl -sSL "https://install.python-poetry.org" | python -
# Adding `poetry` to `$PATH`: # Adding `poetry` to `$PATH`:
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up cache - name: Set up cache
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -62,10 +61,11 @@ jobs:
#---------------------------------------------- #----------------------------------------------
- name: Analysing the code with mypy - name: Analysing the code with mypy
run: | run: |
source .venv/bin/activate
poetry run mypy . poetry run mypy .
- name: Analysing the code with flake8 - name: Analysing the code with flake8
run: | run: |
poetry run flake8 . poetry run flake8 app
- name: Analysing code with isort - name: Analysing code with isort
run: | run: |
poetry run isort --check-only app poetry run isort --check-only app

View File

@ -1,6 +1,6 @@
from aiogram import Dispatcher from aiogram import Dispatcher
from aiogram.utils.executor import start_polling, start_webhook from aiogram.utils.executor import start_polling, start_webhook
from core.bot import bot, dispatcher, driver from core.bot import bot, dispatcher
from core.logger import logger from core.logger import logger
from core.scheduler import asyncio_schedule from core.scheduler import asyncio_schedule
from settings import ( from settings import (
@ -24,8 +24,6 @@ async def on_shutdown(dp: Dispatcher) -> None:
await bot.delete_webhook() await bot.delete_webhook()
# Close DB connection (if used) # Close DB connection (if used)
if driver:
driver.close()
await dp.storage.close() await dp.storage.close()
await dp.storage.wait_closed() await dp.storage.wait_closed()

View File

@ -1,4 +1,6 @@
import asyncio import asyncio
import sys
from pathlib import Path
from typing import Any from typing import Any
import aresponses import aresponses
@ -8,6 +10,9 @@ from aiogram import Bot
BOT_ID = 123456789 BOT_ID = 123456789
TOKEN = f'{BOT_ID}:AABBCCDDEEFFaabbccddeeff-1234567890' TOKEN = f'{BOT_ID}:AABBCCDDEEFFaabbccddeeff-1234567890'
# include pytest directory in PATH
sys.path.append(Path(__file__).parent.parent.as_posix())
class FakeTelegram(aresponses.ResponsesMockServer): class FakeTelegram(aresponses.ResponsesMockServer):
def __init__( def __init__(