mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 01:15:31 +00:00
Use AsyncMock with python 3.8 instead of asynctest
This commit is contained in:
parent
6f56f24296
commit
8e5cb067df
8 changed files with 123 additions and 105 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import copy
|
||||
|
||||
import pytest
|
||||
from asynctest import CoroutineMock, patch
|
||||
|
||||
from aiogram.api.client.base import BaseBot
|
||||
from aiogram.api.client.session.aiohttp import AiohttpSession
|
||||
from aiogram.api.methods import GetMe
|
||||
|
||||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch
|
||||
|
||||
|
||||
class TestBaseBot:
|
||||
def test_init(self):
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@ from typing import AsyncContextManager
|
|||
import aiohttp
|
||||
import pytest
|
||||
from aresponses import ResponsesMockServer
|
||||
from asynctest import CoroutineMock, patch
|
||||
|
||||
from aiogram.api.client.session.aiohttp import AiohttpSession
|
||||
from aiogram.api.methods import Request, TelegramMethod
|
||||
from aiogram.api.types import InputFile
|
||||
|
||||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch
|
||||
|
||||
|
||||
class BareInputFile(InputFile):
|
||||
async def read(self, chunk_size: int):
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@ import datetime
|
|||
from typing import AsyncContextManager
|
||||
|
||||
import pytest
|
||||
from asynctest import CoroutineMock, patch
|
||||
|
||||
from aiogram.api.client.session.base import BaseSession, T
|
||||
from aiogram.api.client.telegram import PRODUCTION, TelegramAPIServer
|
||||
from aiogram.api.methods import GetMe, Response, TelegramMethod
|
||||
from aiogram.utils.mixins import DataMixin
|
||||
|
||||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch
|
||||
|
||||
|
||||
class CustomSession(BaseSession):
|
||||
async def close(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue