diff --git a/coredis/connection.py b/coredis/connection.py index 7873c4da..f37f7d6b 100644 --- a/coredis/connection.py +++ b/coredis/connection.py @@ -620,7 +620,7 @@ def __init__( @override async def _connect(self) -> ByteStream: with fail_after(self._connect_timeout): - connection = await connect_tcp(self.host, self.port) + connection: ByteStream = await connect_tcp(self.host, self.port) if self.ssl_context: connection = await TLSStream.wrap( connection, diff --git a/pytest.ini b/pytest.ini index ebd4c2d2..fb6d1ff1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,5 @@ [pytest] +anyio_mode = auto testpaths = tests addopts = --verbose diff --git a/tests/commands/test_acl.py b/tests/commands/test_acl.py index 65d3463e..b882094b 100644 --- a/tests/commands/test_acl.py +++ b/tests/commands/test_acl.py @@ -5,8 +5,6 @@ from coredis.exceptions import AuthenticationError, AuthorizationError, ResponseError from tests.conftest import targets -pytestmark = pytest.mark.anyio - @pytest.fixture(autouse=True, scope="function") async def teardown(client): diff --git a/tests/commands/test_bitmap.py b/tests/commands/test_bitmap.py index b77813ba..d8d212a2 100644 --- a/tests/commands/test_bitmap.py +++ b/tests/commands/test_bitmap.py @@ -6,8 +6,6 @@ from coredis.exceptions import CommandSyntaxError, ReadOnlyError, RedisError from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_functions.py b/tests/commands/test_functions.py index 5d3bbee9..e6f408ce 100644 --- a/tests/commands/test_functions.py +++ b/tests/commands/test_functions.py @@ -9,8 +9,6 @@ from coredis.typing import KeyT, RedisValueT, StringT from tests.conftest import targets -pytestmark = pytest.mark.anyio - library_definition = """#!lua name=coredis local function echo_key(keys, args) diff --git a/tests/commands/test_generic.py b/tests/commands/test_generic.py index 64d7ba7a..aa6c671e 100644 --- a/tests/commands/test_generic.py +++ b/tests/commands/test_generic.py @@ -9,8 +9,6 @@ from coredis.exceptions import DataError, NoKeyError, ResponseError from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_geo.py b/tests/commands/test_geo.py index 88eb0827..39cf84b8 100644 --- a/tests/commands/test_geo.py +++ b/tests/commands/test_geo.py @@ -6,8 +6,6 @@ from coredis.exceptions import CommandSyntaxError, DataError from tests.conftest import server_deprecation_warning, targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_hash.py b/tests/commands/test_hash.py index b548c094..3a3f7540 100644 --- a/tests/commands/test_hash.py +++ b/tests/commands/test_hash.py @@ -10,8 +10,6 @@ from coredis.exceptions import CommandSyntaxError from tests.conftest import server_deprecation_warning, targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_hyperloglog.py b/tests/commands/test_hyperloglog.py index 2c30613e..f3164d14 100644 --- a/tests/commands/test_hyperloglog.py +++ b/tests/commands/test_hyperloglog.py @@ -4,8 +4,6 @@ from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_list.py b/tests/commands/test_list.py index 9f2ca802..cca17551 100644 --- a/tests/commands/test_list.py +++ b/tests/commands/test_list.py @@ -7,8 +7,6 @@ from coredis._utils import gather from tests.conftest import server_deprecation_warning, targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_server.py b/tests/commands/test_server.py index 9380d284..e8c3de4d 100644 --- a/tests/commands/test_server.py +++ b/tests/commands/test_server.py @@ -12,8 +12,6 @@ from coredis.typing import RedisCommand from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_set.py b/tests/commands/test_set.py index 69c6913e..4e69a051 100644 --- a/tests/commands/test_set.py +++ b/tests/commands/test_set.py @@ -4,8 +4,6 @@ from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_sorted_set.py b/tests/commands/test_sorted_set.py index f53273cf..f628257a 100644 --- a/tests/commands/test_sorted_set.py +++ b/tests/commands/test_sorted_set.py @@ -8,8 +8,6 @@ from coredis.exceptions import CommandSyntaxError, DataError from tests.conftest import server_deprecation_warning, targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_streams.py b/tests/commands/test_streams.py index 60d11633..71c3da86 100644 --- a/tests/commands/test_streams.py +++ b/tests/commands/test_streams.py @@ -13,8 +13,6 @@ ) from tests.conftest import targets -pytestmark = pytest.mark.anyio - async def get_stream_message(client, stream, message_id): "Fetch a stream message and format it as a (message_id, fields) pair" diff --git a/tests/commands/test_string.py b/tests/commands/test_string.py index 4469dd2a..23ad252e 100644 --- a/tests/commands/test_string.py +++ b/tests/commands/test_string.py @@ -8,8 +8,6 @@ from coredis.exceptions import CommandSyntaxError from tests.conftest import server_deprecation_warning, targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/commands/test_vector_sets.py b/tests/commands/test_vector_sets.py index 51cac4fb..5f9214ef 100644 --- a/tests/commands/test_vector_sets.py +++ b/tests/commands/test_vector_sets.py @@ -8,8 +8,6 @@ from coredis.exceptions import CommandSyntaxError, ResponseError from tests.conftest import targets -pytestmark = pytest.mark.anyio - @pytest.fixture async def sample_data(client): diff --git a/tests/conftest.py b/tests/conftest.py index cbe03af9..33df9a62 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -111,10 +111,10 @@ async def get_version(client): if str(client) not in REDIS_VERSIONS: try: if isinstance(client, coredis.RedisCluster): - await client node = list(client.primaries).pop() - version_string = (await node.info())["redis_version"] - REDIS_VERSIONS[str(client)] = version.parse(version_string) + async with node: + version_string = (await node.info())["redis_version"] + REDIS_VERSIONS[str(client)] = version.parse(version_string) elif isinstance(client, coredis.sentinel.Sentinel): version_string = (await client.sentinels[0].info())["redis_version"] REDIS_VERSIONS[str(client)] = version.parse(version_string) @@ -137,8 +137,9 @@ async def get_version(client): async def check_test_constraints(request, client, protocol=3): - await get_version(client) - await get_module_versions(client) + async with client: + await get_version(client) + await get_module_versions(client) client_version = REDIS_VERSIONS[str(client)] for marker in request.node.iter_markers(): if marker.name == "min_python" and marker.args: @@ -485,8 +486,8 @@ async def redis_basic(redis_basic_server, request): ), **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -501,8 +502,8 @@ async def redis_basic_resp2(redis_basic_server, request): protocol_version=2, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -523,8 +524,8 @@ async def redis_basic_blocking(redis_basic_server, request): ), **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -535,8 +536,8 @@ async def redis_stack(redis_stack_server, request): client = coredis.Redis( *redis_stack_server, decode_responses=True, **get_client_test_args(request) ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -545,8 +546,8 @@ async def redis_stack(redis_stack_server, request): @pytest.fixture async def redis_stack_raw(redis_stack_server, request): client = coredis.Redis(*redis_stack_server, **get_client_test_args(request)) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -561,8 +562,8 @@ async def redis_stack_cached(redis_stack_server, request): cache=cache, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -574,8 +575,8 @@ async def redis_basic_raw(redis_basic_server, request): client = coredis.Redis( "localhost", 6379, decode_responses=False, **get_client_test_args(request) ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -592,8 +593,8 @@ async def redis_ssl(redis_ssl_server, request): client = coredis.Redis.from_url( storage_url, decode_responses=True, **get_client_test_args(request) ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -605,8 +606,8 @@ async def redis_ssl_no_client_auth(redis_ssl_server_no_client_auth, request): client = coredis.Redis.from_url( storage_url, decode_responses=True, **get_client_test_args(request) ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -619,8 +620,8 @@ async def redis_auth(redis_auth_server, request): decode_responses=True, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -635,8 +636,8 @@ async def redis_auth_cred_provider(redis_auth_server, request): decode_responses=True, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -649,8 +650,8 @@ async def redis_uds(redis_uds_server, request): decode_responses=True, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -666,8 +667,8 @@ async def redis_cached(redis_basic_server, request): cache=cache, **get_client_test_args(request), ) + await check_test_constraints(request, client) async with client: - await check_test_constraints(request, client) await client.flushall() await set_default_test_config(client) yield client @@ -683,17 +684,16 @@ async def redis_cluster(redis_cluster_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) - - async with remapped_slots(cluster, request): - yield cluster + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -706,17 +706,16 @@ async def redis_cluster_auth(redis_cluster_auth_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) - async with remapped_slots(cluster, request): - yield cluster - - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -729,17 +728,16 @@ async def redis_cluster_auth_cred_provider(redis_cluster_auth_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() - - for primary in cluster.primaries: - await set_default_test_config(primary) + async with cluster: + await cluster.flushall() + await cluster.flushdb() - async with remapped_slots(cluster, request): - yield cluster + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -756,17 +754,16 @@ async def redis_cluster_blocking(redis_cluster_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() - - for primary in cluster.primaries: - await set_default_test_config(primary) + async with cluster: + await cluster.flushall() + await cluster.flushdb() - async with remapped_slots(cluster, request): - yield cluster + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -778,17 +775,15 @@ async def redis_cluster_noreplica(redis_cluster_noreplica_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) + for primary in cluster.primaries: + await set_default_test_config(primary) - async with remapped_slots(cluster, request): - yield cluster - - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -804,15 +799,13 @@ async def redis_cluster_ssl(redis_ssl_cluster_server, request): ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() - - for primary in cluster.primaries: - await set_default_test_config(primary) - yield cluster + async with cluster: + await cluster.flushall() + await cluster.flushdb() - cluster.connection_pool.disconnect() + for primary in cluster.primaries: + await set_default_test_config(primary) + yield cluster @pytest.fixture @@ -826,15 +819,14 @@ async def redis_cluster_cached(redis_cluster_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) - yield cluster - - cluster.connection_pool.disconnect() + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) + yield cluster cache.shutdown() @@ -846,15 +838,14 @@ async def redis_cluster_raw(redis_cluster_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) - yield cluster - - cluster.connection_pool.disconnect() + for primary in cluster.primaries: + async with primary: + await set_default_test_config(primary) + yield cluster @pytest.fixture @@ -865,17 +856,15 @@ async def redis_stack_cluster(redis_stack_cluster_server, request): **get_client_test_args(request), ) await check_test_constraints(request, cluster) - await cluster - await cluster.flushall() - await cluster.flushdb() + async with cluster: + await cluster.flushall() + await cluster.flushdb() - for primary in cluster.primaries: - await set_default_test_config(primary) + for primary in cluster.primaries: + await set_default_test_config(primary) - async with remapped_slots(cluster, request): - yield cluster - - cluster.connection_pool.disconnect() + async with remapped_slots(cluster, request): + yield cluster @pytest.fixture @@ -897,12 +886,13 @@ async def redis_sentinel_raw(redis_sentinel_server, request): sentinel_kwargs={}, **get_client_test_args(request), ) - master = sentinel.primary_for("mymaster") - async with master: + async with sentinel: + master = sentinel.primary_for("mymaster") await check_test_constraints(request, master) - await set_default_test_config(sentinel) - await master.flushall() - return sentinel + async with master: + await set_default_test_config(sentinel) + await master.flushall() + yield sentinel @pytest.fixture @@ -914,12 +904,14 @@ async def redis_sentinel_resp2(redis_sentinel_server, request): protocol_version=2, **get_client_test_args(request), ) - master = sentinel.primary_for("mymaster") - await check_test_constraints(request, master) - await set_default_test_config(sentinel) - await master.flushall() + async with sentinel: + master = sentinel.primary_for("mymaster") + await check_test_constraints(request, master) + async with master: + await set_default_test_config(sentinel) + await master.flushall() - return sentinel + yield sentinel @pytest.fixture @@ -931,13 +923,15 @@ async def redis_sentinel_auth(redis_sentinel_auth_server, request): decode_responses=True, **get_client_test_args(request), ) - master = sentinel.primary_for("mymaster") - await check_test_constraints(request, master) - await set_default_test_config(sentinel) - await master.flushall() - await asyncio.sleep(0.1) + async with sentinel: + master = sentinel.primary_for("mymaster") + await check_test_constraints(request, master) + async with master: + await set_default_test_config(sentinel) + await master.flushall() + await asyncio.sleep(0.1) - return sentinel + yield sentinel @pytest.fixture @@ -949,13 +943,15 @@ async def redis_sentinel_auth_cred_provider(redis_sentinel_auth_server, request) decode_responses=True, **get_client_test_args(request), ) - master = sentinel.primary_for("mymaster") - await check_test_constraints(request, master) - await set_default_test_config(sentinel) - await master.flushall() - await asyncio.sleep(0.1) + async with sentinel: + master = sentinel.primary_for("mymaster") + await check_test_constraints(request, master) + async with master: + await set_default_test_config(sentinel) + await master.flushall() + await asyncio.sleep(0.1) - return sentinel + yield sentinel @pytest.fixture @@ -1022,12 +1018,10 @@ async def dragonfly(dragonfly_server, request): **get_client_test_args(request), ) await check_test_constraints(request, client, protocol=2) - await client.flushall() - await set_default_test_config(client, variant="dragonfly") - - yield client - - client.connection_pool.disconnect() + async with client: + await client.flushall() + await set_default_test_config(client, variant="dragonfly") + yield client @pytest.fixture @@ -1038,13 +1032,11 @@ async def valkey(valkey_server, request): decode_responses=True, **get_client_test_args(request), ) - await client.flushall() await check_test_constraints(request, client) - await set_default_test_config(client, variant="valkey") - - yield client - - client.connection_pool.disconnect() + async with client: + await client.flushall() + await set_default_test_config(client, variant="valkey") + yield client @pytest.fixture @@ -1055,13 +1047,11 @@ async def redict(redict_server, request): decode_responses=True, **get_client_test_args(request), ) - await client.flushall() await check_test_constraints(request, client) - await set_default_test_config(client, variant="redict") - - yield client - - client.connection_pool.disconnect() + async with client: + await client.flushall() + await set_default_test_config(client, variant="redict") + yield client @pytest.fixture(scope="session") @@ -1112,7 +1102,8 @@ async def _get_server_time(client): if isinstance(client, coredis.RedisCluster): node = list(client.primaries).pop() - return await node.time() + async with node: + return await node.time() elif isinstance(client, coredis.Redis): return await client.time() diff --git a/tests/modules/test_autocomplete.py b/tests/modules/test_autocomplete.py index 161c003f..3aed7b29 100644 --- a/tests/modules/test_autocomplete.py +++ b/tests/modules/test_autocomplete.py @@ -8,8 +8,6 @@ from coredis.modules.response.types import AutocompleteSuggestion from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestAutocomplete: diff --git a/tests/modules/test_bloom_filter.py b/tests/modules/test_bloom_filter.py index d5a6fc23..97966f6f 100644 --- a/tests/modules/test_bloom_filter.py +++ b/tests/modules/test_bloom_filter.py @@ -8,8 +8,6 @@ from coredis.exceptions import ResponseError from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestBloomFilter: diff --git a/tests/modules/test_compatibilty.py b/tests/modules/test_compatibilty.py index da4cabd9..e7c416f7 100644 --- a/tests/modules/test_compatibilty.py +++ b/tests/modules/test_compatibilty.py @@ -6,8 +6,6 @@ from coredis.exceptions import CommandSyntaxError, ModuleCommandNotSupportedError from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestModuleCompatibility: diff --git a/tests/modules/test_count_min_sketch.py b/tests/modules/test_count_min_sketch.py index 66326066..f5059df8 100644 --- a/tests/modules/test_count_min_sketch.py +++ b/tests/modules/test_count_min_sketch.py @@ -8,8 +8,6 @@ from coredis.exceptions import ResponseError from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestCountMinSketch: diff --git a/tests/modules/test_cuckoo_filter.py b/tests/modules/test_cuckoo_filter.py index b156fa20..01a8d9af 100644 --- a/tests/modules/test_cuckoo_filter.py +++ b/tests/modules/test_cuckoo_filter.py @@ -8,8 +8,6 @@ from coredis.exceptions import ResponseError from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestCuckooFilter: diff --git a/tests/modules/test_graph.py b/tests/modules/test_graph.py index 8efa9a74..84b616a6 100644 --- a/tests/modules/test_graph.py +++ b/tests/modules/test_graph.py @@ -9,8 +9,6 @@ from coredis.modules.response.types import GraphNode, GraphQueryResult from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() @pytest.mark.max_server_version("7.0.0") diff --git a/tests/modules/test_json.py b/tests/modules/test_json.py index 153b4cea..c199b6b4 100644 --- a/tests/modules/test_json.py +++ b/tests/modules/test_json.py @@ -6,8 +6,6 @@ from coredis.exceptions import ResponseError from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - LEGACY_ROOT_PATH = "." diff --git a/tests/modules/test_search.py b/tests/modules/test_search.py index 9f5daba7..5050b379 100644 --- a/tests/modules/test_search.py +++ b/tests/modules/test_search.py @@ -17,8 +17,6 @@ from coredis.retry import ConstantRetryPolicy, retryable from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @pytest.fixture(scope="module") def query_vectors(): diff --git a/tests/modules/test_tdigest.py b/tests/modules/test_tdigest.py index 5f544113..abee050d 100644 --- a/tests/modules/test_tdigest.py +++ b/tests/modules/test_tdigest.py @@ -7,8 +7,6 @@ from coredis import Redis from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @pytest.mark.min_module_version("bf", "2.4.0") @module_targets() diff --git a/tests/modules/test_timeseries.py b/tests/modules/test_timeseries.py index 6805e71b..bad5bfe7 100644 --- a/tests/modules/test_timeseries.py +++ b/tests/modules/test_timeseries.py @@ -10,8 +10,6 @@ from coredis import PureToken, Redis from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestTimeseries: diff --git a/tests/modules/test_topk.py b/tests/modules/test_topk.py index ba06e205..e5da04a7 100644 --- a/tests/modules/test_topk.py +++ b/tests/modules/test_topk.py @@ -7,8 +7,6 @@ from coredis import Redis from tests.conftest import module_targets -pytestmark = pytest.mark.anyio - @module_targets() class TestTopK: diff --git a/tests/recipes/credentials/test_elasticache_iam_provider.py b/tests/recipes/credentials/test_elasticache_iam_provider.py index bd772239..bcb06803 100644 --- a/tests/recipes/credentials/test_elasticache_iam_provider.py +++ b/tests/recipes/credentials/test_elasticache_iam_provider.py @@ -1,12 +1,9 @@ from __future__ import annotations -import pytest from moto import mock_aws from coredis.recipes.credentials import ElastiCacheIAMProvider -pytestmark = pytest.mark.anyio - class TestElastiCacheIAMProvider: async def test_get_credentials(self): diff --git a/tests/recipes/locks/test_lua_lock.py b/tests/recipes/locks/test_lua_lock.py index 2afed3d3..1f98552c 100644 --- a/tests/recipes/locks/test_lua_lock.py +++ b/tests/recipes/locks/test_lua_lock.py @@ -9,8 +9,6 @@ from coredis.recipes.locks import Lock from tests.conftest import targets -pytestmark = pytest.mark.anyio - @pytest.fixture def lock_name(): diff --git a/tests/test_authentication.py b/tests/test_authentication.py index d32e0707..b25958c9 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -6,8 +6,6 @@ from coredis.credentials import UserPassCredentialProvider from coredis.exceptions import AuthenticationError, ConnectionError -pytestmark = pytest.mark.anyio - @pytest.mark.parametrize( "username, password", diff --git a/tests/test_connection.py b/tests/test_connection.py index d9aa0426..46b078d6 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -10,8 +10,6 @@ from coredis.credentials import UserPassCredentialProvider from coredis.exceptions import TimeoutError -pytestmark = pytest.mark.anyio - async def test_connect_tcp(redis_basic): conn = Connection() diff --git a/tests/test_connection_pool.py b/tests/test_connection_pool.py index 331c3e12..a7456671 100644 --- a/tests/test_connection_pool.py +++ b/tests/test_connection_pool.py @@ -14,8 +14,6 @@ RedisError, ) -pytestmark = pytest.mark.anyio - class TestConnectionPool: def get_pool( diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index ca4cda54..4fd63cca 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -16,8 +16,6 @@ from coredis.typing import Serializable from tests.conftest import targets -pytestmark = pytest.mark.anyio - @targets( "redis_basic", diff --git a/tests/test_pubsub.py b/tests/test_pubsub.py index a35b1c6d..340a0612 100644 --- a/tests/test_pubsub.py +++ b/tests/test_pubsub.py @@ -11,8 +11,6 @@ from coredis.exceptions import ConnectionError from tests.conftest import targets -pytestmark = pytest.mark.anyio - async def wait_for_message(pubsub: PubSub, timeout=0.5, ignore_subscribe_messages=False): now = time.time() diff --git a/tests/test_scripting.py b/tests/test_scripting.py index 269c8161..d3c56e7c 100644 --- a/tests/test_scripting.py +++ b/tests/test_scripting.py @@ -12,8 +12,6 @@ from coredis.typing import AnyStr, KeyT, RedisValueT from tests.conftest import targets -pytestmark = pytest.mark.anyio - multiply_script = """ local value = redis.call('GET', KEYS[1]) value = tonumber(value) diff --git a/tests/test_sentinel.py b/tests/test_sentinel.py index 25dbaf69..5194adc8 100644 --- a/tests/test_sentinel.py +++ b/tests/test_sentinel.py @@ -13,8 +13,6 @@ from coredis.sentinel import Sentinel, SentinelConnectionPool from tests.conftest import targets -pytestmark = pytest.mark.anyio - async def test_init_compose_sentinel(redis_sentinel: Sentinel): print(await redis_sentinel.discover_primary("mymaster"))