Update tests and small refactoring

This commit is contained in:
Alex Root Junior 2019-11-16 22:32:26 +02:00
parent 65331e1fda
commit 7dc2a0ddaf
10 changed files with 18 additions and 15 deletions

View file

@ -1,6 +1,8 @@
.DEFAULT_GOAL := help
python := python3.7
base_python := python3.7
py := poetry run
python := $(py) python
.PHONY: help
help:
@ -32,7 +34,7 @@ help:
.PHONY: install
install:
$(python) -m pip install --user -U poetry
$(base_python) -m pip install --user -U poetry
poetry install
.PHONY: clean
@ -53,19 +55,19 @@ clean:
.PHONY: isort
isort:
poetry run isort -rc aiogram tests
$(py) isort -rc aiogram tests
.PHONY: black
black:
poetry run black aiogram tests
$(py) black aiogram tests
.PHONY: flake8
flake8:
poetry run flake8 aiogram tests
$(py) flake8 aiogram tests
.PHONY: mypy
mypy:
poetry run mypy aiogram tests
$(py) mypy aiogram tests
.PHONY: lint
lint: isort black flake8 mypy
@ -77,7 +79,7 @@ lint: isort black flake8 mypy
.PHONY: test
test:
poetry run pytest --cov=aiogram --cov-config .coveragerc tests/ -sq
$(py) pytest --cov=aiogram --cov-config .coveragerc tests/ -sq
# =================================================================================================
@ -86,8 +88,8 @@ test:
.PHONY: docs
docs:
mkdocs build
$(py) mkdocs build
.PHONY: docs-serve
docs-serve:
mkdocs serve
$(py) mkdocs serve

View file

@ -1,4 +1,5 @@
from .api import methods, session, types
from .api import methods, types
from .api.client import session
from .api.client.bot import Bot
__all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"]

View file

@ -2,8 +2,8 @@ from typing import TypeVar
from ...utils.mixins import ContextInstanceMixin
from ..methods import TelegramMethod
from ..session.aiohttp import AiohttpSession
from ..session.base import BaseSession
from aiogram.api.client.session.aiohttp import AiohttpSession
from aiogram.api.client.session.base import BaseSession
T = TypeVar("T")

View file

@ -2,7 +2,7 @@ from typing import Callable, Optional, TypeVar, cast
from aiohttp import ClientSession, FormData
from ..methods import Request, TelegramMethod
from aiogram.api.methods import Request, TelegramMethod
from .base import PRODUCTION, BaseSession, TelegramAPIServer
T = TypeVar("T")

View file

@ -1,4 +1,4 @@
from aiogram.api.session.base import PRODUCTION
from aiogram.api.client.session.base import PRODUCTION
class TestAPIServer:

View file

@ -4,7 +4,7 @@ from unittest.mock import patch
import pytest
from asynctest import CoroutineMock
from aiogram.api.session.base import BaseSession
from aiogram.api.client.session.base import BaseSession
from aiogram.utils.mixins import DataMixin