diff --git a/tests/conftest.py b/tests/conftest.py index b2581bd920..61cd2b2fc4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,6 +20,7 @@ def pytest_addoption(parser): default=None, help="run tests which require redis connection", ) + parser.addini("asyncio_mode", "", default='auto') def pytest_configure(config): diff --git a/tests/test_bot.py b/tests/test_bot.py index 9e4d45de46..1a61fd2d6e 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -3,8 +3,6 @@ from aiogram import Bot, types from . import BOT_ID, FakeTelegram -pytestmark = pytest.mark.asyncio - async def test_get_me(bot: Bot): """ getMe method test """ diff --git a/tests/test_bot/test_bot_download_file.py b/tests/test_bot/test_bot_download_file.py index c5b5077c0f..ff50dc9ed4 100644 --- a/tests/test_bot/test_bot_download_file.py +++ b/tests/test_bot/test_bot_download_file.py @@ -13,8 +13,6 @@ from tests import TOKEN from tests.types.dataset import FILE -pytestmark = pytest.mark.asyncio - @pytest_asyncio.fixture(name='bot') async def bot_fixture(): diff --git a/tests/test_contrib/test_fsm_storage/test_storage.py b/tests/test_contrib/test_fsm_storage/test_storage.py index 93295c9193..68ce8a813f 100644 --- a/tests/test_contrib/test_fsm_storage/test_storage.py +++ b/tests/test_contrib/test_fsm_storage/test_storage.py @@ -6,10 +6,7 @@ from aiogram.contrib.fsm_storage.memory import MemoryStorage 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.mark.redis diff --git a/tests/test_dispatcher.py b/tests/test_dispatcher.py index e38d7c4abd..aa8dd38447 100644 --- a/tests/test_dispatcher.py +++ b/tests/test_dispatcher.py @@ -2,8 +2,6 @@ from aiogram import Dispatcher, Bot -pytestmark = pytest.mark.asyncio - class TestDispatcherInit: async def test_successful_init(self, bot): diff --git a/tests/test_dispatcher/test_middlewares/test_lifetimecontroller.py b/tests/test_dispatcher/test_middlewares/test_lifetimecontroller.py index b4519a9b75..647e473368 100644 --- a/tests/test_dispatcher/test_middlewares/test_lifetimecontroller.py +++ b/tests/test_dispatcher/test_middlewares/test_lifetimecontroller.py @@ -1,10 +1,7 @@ from unittest.mock import AsyncMock -import pytest from aiogram.dispatcher.middlewares import LifetimeControllerMiddleware -pytestmark = pytest.mark.asyncio - async def test_no_skip(): class Middleware(LifetimeControllerMiddleware): diff --git a/tests/test_filters.py b/tests/test_filters.py index f29e1982e6..b135b6be1a 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -6,9 +6,6 @@ from aiogram.dispatcher.filters import Text, CommandStart from aiogram.types import Message, CallbackQuery, InlineQuery, Poll -# enable asyncio mode -pytestmark = pytest.mark.asyncio - def data_sample_1(): return [ diff --git a/tests/test_message.py b/tests/test_message.py index aea1130294..3e29885ea8 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -4,8 +4,6 @@ from aiogram import Bot, types from . import FakeTelegram -pytestmark = pytest.mark.asyncio - @pytest_asyncio.fixture(name="message") async def message_fixture(bot: Bot): diff --git a/tests/test_utils/test_deep_linking.py b/tests/test_utils/test_deep_linking.py index f4aa14f148..64effbab8a 100644 --- a/tests/test_utils/test_deep_linking.py +++ b/tests/test_utils/test_deep_linking.py @@ -8,8 +8,6 @@ ) from tests.types import dataset -# enable asyncio mode -pytestmark = pytest.mark.asyncio PAYLOADS = [ 'foo', diff --git a/tests/types/test_chat.py b/tests/types/test_chat.py index c8e2014641..c31f4f3526 100644 --- a/tests/types/test_chat.py +++ b/tests/types/test_chat.py @@ -1,10 +1,7 @@ -import pytest - from aiogram import Bot, types from .dataset import CHAT, FULL_CHAT from .. import FakeTelegram -pytestmark = pytest.mark.asyncio chat = types.Chat(**CHAT) diff --git a/tests/types/test_mixins.py b/tests/types/test_mixins.py index 84ec991a3e..28dee2b89d 100644 --- a/tests/types/test_mixins.py +++ b/tests/types/test_mixins.py @@ -14,8 +14,6 @@ from tests import TOKEN from tests.types.dataset import FILE -pytestmark = pytest.mark.asyncio - @pytest_asyncio.fixture(name='bot') async def bot_fixture():