Just try to set custom event loop policy manually

This commit is contained in:
JRoot Junior 2024-08-07 00:49:15 +03:00
parent 17652f038d
commit 04ee60d878
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
4 changed files with 24 additions and 25 deletions

View file

@ -62,29 +62,29 @@ redis = [
"redis[hiredis]~=5.0.1", "redis[hiredis]~=5.0.1",
] ]
mongo = [ mongo = [
"motor~=3.3.2", "motor~=3.5.1",
] ]
proxy = [ proxy = [
"aiohttp-socks~=0.8.3", "aiohttp-socks~=0.9.0",
] ]
i18n = [ i18n = [
"Babel~=2.13.0", "Babel~=2.13.0",
] ]
cli = [ cli = [
"aiogram-cli~=1.0.3", "aiogram-cli~=1.1.0",
] ]
test = [ test = [
"pytest~=7.4.2", "pytest~=8.3.2",
"pytest-html~=4.0.2", "pytest-html~=4.1.1",
"pytest-asyncio~=0.21.1", "pytest-asyncio~=0.23.8",
"pytest-lazy-fixture~=0.6.3", "pytest-lazy-fixtures~=1.1.1",
"pytest-mock~=3.12.0", "pytest-mock~=3.14.0",
"pytest-mypy~=0.10.3", "pytest-mypy~=0.10.3",
"pytest-cov~=4.1.0", "pytest-cov~=5.0.0",
"pytest-aiohttp~=1.0.5", "pytest-aiohttp~=1.0.5",
"aresponses~=2.1.6", "aresponses~=3.0.0",
"pytz~=2023.3", "pytz~=2024.1",
"pycryptodomex~=3.19.0", "pycryptodomex~=3.20.0",
] ]
docs = [ docs = [
"Sphinx~=7.2.6", "Sphinx~=7.2.6",
@ -101,10 +101,10 @@ docs = [
"sphinxcontrib-towncrier~=0.3.2a0", "sphinxcontrib-towncrier~=0.3.2a0",
] ]
dev = [ dev = [
"black~=24.4.2", "black~=24.8.0",
"isort~=5.13.2", "isort~=5.13.2",
"ruff~=0.5.1", "ruff~=0.5.1",
"mypy~=1.10.0", "mypy~=1.11.1",
"toml~=0.10.2", "toml~=0.10.2",
"pre-commit~=3.5", "pre-commit~=3.5",
"packaging~=24.1", "packaging~=24.1",

View file

@ -40,7 +40,8 @@ def pytest_configure(config):
if sys.platform == "win32": if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
return asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy()) else:
asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
@pytest.fixture() @pytest.fixture()
@ -53,7 +54,6 @@ def redis_server(request):
@pytest.fixture() @pytest.fixture()
@pytest.mark.redis
async def redis_storage(redis_server): async def redis_storage(redis_server):
try: try:
parse_redis_url(redis_server) parse_redis_url(redis_server)
@ -82,7 +82,6 @@ def mongo_server(request):
@pytest.fixture() @pytest.fixture()
@pytest.mark.mongo
async def mongo_storage(mongo_server): async def mongo_storage(mongo_server):
try: try:
parse_mongo_url(mongo_server) parse_mongo_url(mongo_server)
@ -113,7 +112,6 @@ async def memory_storage():
@pytest.fixture() @pytest.fixture()
@pytest.mark.redis
async def redis_isolation(redis_storage): async def redis_isolation(redis_storage):
isolation = redis_storage.create_isolation() isolation = redis_storage.create_isolation()
return isolation return isolation

View file

@ -1,7 +1,7 @@
from unittest import mock
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
import pytest import pytest
from pytest_lazy_fixtures import lf
from aiogram.fsm.storage.base import BaseEventIsolation, StorageKey from aiogram.fsm.storage.base import BaseEventIsolation, StorageKey
from aiogram.fsm.storage.redis import RedisEventIsolation, RedisStorage from aiogram.fsm.storage.redis import RedisEventIsolation, RedisStorage
@ -10,9 +10,9 @@ from aiogram.fsm.storage.redis import RedisEventIsolation, RedisStorage
@pytest.mark.parametrize( @pytest.mark.parametrize(
"isolation", "isolation",
[ [
pytest.lazy_fixture("redis_isolation"), lf("redis_isolation"),
pytest.lazy_fixture("lock_isolation"), lf("lock_isolation"),
pytest.lazy_fixture("disabled_isolation"), lf("disabled_isolation"),
], ],
) )
class TestIsolations: class TestIsolations:

View file

@ -1,4 +1,5 @@
import pytest import pytest
from pytest_lazy_fixtures import lf
from aiogram.fsm.storage.base import BaseStorage, StorageKey from aiogram.fsm.storage.base import BaseStorage, StorageKey
@ -6,9 +7,9 @@ from aiogram.fsm.storage.base import BaseStorage, StorageKey
@pytest.mark.parametrize( @pytest.mark.parametrize(
"storage", "storage",
[ [
pytest.lazy_fixture("redis_storage"), lf("redis_storage"),
pytest.lazy_fixture("mongo_storage"), lf("mongo_storage"),
pytest.lazy_fixture("memory_storage"), lf("memory_storage"),
], ],
) )
class TestStorages: class TestStorages: