mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
Fix warning about asyncio marker (#1078)
This commit is contained in:
parent
491c2ca677
commit
64eb41db96
11 changed files with 1 additions and 24 deletions
|
|
@ -20,6 +20,7 @@ def pytest_addoption(parser):
|
||||||
default=None,
|
default=None,
|
||||||
help="run tests which require redis connection",
|
help="run tests which require redis connection",
|
||||||
)
|
)
|
||||||
|
parser.addini("asyncio_mode", "", default='auto')
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ import pytest
|
||||||
from aiogram import Bot, types
|
from aiogram import Bot, types
|
||||||
from . import BOT_ID, FakeTelegram
|
from . import BOT_ID, FakeTelegram
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
async def test_get_me(bot: Bot):
|
async def test_get_me(bot: Bot):
|
||||||
""" getMe method test """
|
""" getMe method test """
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ from aiogram.utils.json import json
|
||||||
from tests import TOKEN
|
from tests import TOKEN
|
||||||
from tests.types.dataset import FILE
|
from tests.types.dataset import FILE
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture(name='bot')
|
@pytest_asyncio.fixture(name='bot')
|
||||||
async def bot_fixture():
|
async def bot_fixture():
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ from redis.asyncio.connection import Connection, ConnectionPool
|
||||||
|
|
||||||
from aiogram.contrib.fsm_storage.memory import MemoryStorage
|
from aiogram.contrib.fsm_storage.memory import MemoryStorage
|
||||||
from aiogram.contrib.fsm_storage.redis import RedisStorage, RedisStorage2
|
from aiogram.contrib.fsm_storage.redis import RedisStorage, RedisStorage2
|
||||||
from aiogram.types import Chat, User
|
|
||||||
from tests.types.dataset import CHAT, USER
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture()
|
@pytest_asyncio.fixture()
|
||||||
@pytest.mark.redis
|
@pytest.mark.redis
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import pytest
|
||||||
|
|
||||||
from aiogram import Dispatcher, Bot
|
from aiogram import Dispatcher, Bot
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
class TestDispatcherInit:
|
class TestDispatcherInit:
|
||||||
async def test_successful_init(self, bot):
|
async def test_successful_init(self, bot):
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
import pytest
|
|
||||||
from aiogram.dispatcher.middlewares import LifetimeControllerMiddleware
|
from aiogram.dispatcher.middlewares import LifetimeControllerMiddleware
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
async def test_no_skip():
|
async def test_no_skip():
|
||||||
class Middleware(LifetimeControllerMiddleware):
|
class Middleware(LifetimeControllerMiddleware):
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ import pytest
|
||||||
from aiogram.dispatcher.filters import Text, CommandStart
|
from aiogram.dispatcher.filters import Text, CommandStart
|
||||||
from aiogram.types import Message, CallbackQuery, InlineQuery, Poll
|
from aiogram.types import Message, CallbackQuery, InlineQuery, Poll
|
||||||
|
|
||||||
# enable asyncio mode
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
def data_sample_1():
|
def data_sample_1():
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import pytest_asyncio
|
||||||
from aiogram import Bot, types
|
from aiogram import Bot, types
|
||||||
from . import FakeTelegram
|
from . import FakeTelegram
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture(name="message")
|
@pytest_asyncio.fixture(name="message")
|
||||||
async def message_fixture(bot: Bot):
|
async def message_fixture(bot: Bot):
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ from aiogram.utils.deep_linking import (
|
||||||
)
|
)
|
||||||
from tests.types import dataset
|
from tests.types import dataset
|
||||||
|
|
||||||
# enable asyncio mode
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
PAYLOADS = [
|
PAYLOADS = [
|
||||||
'foo',
|
'foo',
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from aiogram import Bot, types
|
from aiogram import Bot, types
|
||||||
from .dataset import CHAT, FULL_CHAT
|
from .dataset import CHAT, FULL_CHAT
|
||||||
from .. import FakeTelegram
|
from .. import FakeTelegram
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
chat = types.Chat(**CHAT)
|
chat = types.Chat(**CHAT)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ from aiogram.utils.json import json
|
||||||
from tests import TOKEN
|
from tests import TOKEN
|
||||||
from tests.types.dataset import FILE
|
from tests.types.dataset import FILE
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
|
||||||
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture(name='bot')
|
@pytest_asyncio.fixture(name='bot')
|
||||||
async def bot_fixture():
|
async def bot_fixture():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue