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 .DEFAULT_GOAL := help
python := python3.7 base_python := python3.7
py := poetry run
python := $(py) python
.PHONY: help .PHONY: help
help: help:
@ -32,7 +34,7 @@ help:
.PHONY: install .PHONY: install
install: install:
$(python) -m pip install --user -U poetry $(base_python) -m pip install --user -U poetry
poetry install poetry install
.PHONY: clean .PHONY: clean
@ -53,19 +55,19 @@ clean:
.PHONY: isort .PHONY: isort
isort: isort:
poetry run isort -rc aiogram tests $(py) isort -rc aiogram tests
.PHONY: black .PHONY: black
black: black:
poetry run black aiogram tests $(py) black aiogram tests
.PHONY: flake8 .PHONY: flake8
flake8: flake8:
poetry run flake8 aiogram tests $(py) flake8 aiogram tests
.PHONY: mypy .PHONY: mypy
mypy: mypy:
poetry run mypy aiogram tests $(py) mypy aiogram tests
.PHONY: lint .PHONY: lint
lint: isort black flake8 mypy lint: isort black flake8 mypy
@ -77,7 +79,7 @@ lint: isort black flake8 mypy
.PHONY: test .PHONY: test
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 .PHONY: docs
docs: docs:
mkdocs build $(py) mkdocs build
.PHONY: docs-serve .PHONY: docs-serve
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 from .api.client.bot import Bot
__all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"] __all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"]

View file

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

View file

@ -2,7 +2,7 @@ from typing import Callable, Optional, TypeVar, cast
from aiohttp import ClientSession, FormData from aiohttp import ClientSession, FormData
from ..methods import Request, TelegramMethod from aiogram.api.methods import Request, TelegramMethod
from .base import PRODUCTION, BaseSession, TelegramAPIServer from .base import PRODUCTION, BaseSession, TelegramAPIServer
T = TypeVar("T") 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: class TestAPIServer:

View file

@ -4,7 +4,7 @@ from unittest.mock import patch
import pytest import pytest
from asynctest import CoroutineMock 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 from aiogram.utils.mixins import DataMixin