diff --git a/CHANGES b/CHANGES index 8750128b05..6cfaa97c37 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,4 @@ + * No longer necessary check remove from tests * Move doctests (doc code examples) to main branch * Update `ResponseT` type hint * Allow to control the minimum SSL version diff --git a/tests/test_asyncio/compat.py b/tests/test_asyncio/compat.py index aa1dc49af0..97c62c53c3 100644 --- a/tests/test_asyncio/compat.py +++ b/tests/test_asyncio/compat.py @@ -1,10 +1,4 @@ import asyncio -from unittest import mock - -try: - mock.AsyncMock -except AttributeError: - from unittest import mock try: from contextlib import aclosing diff --git a/tests/test_asyncio/conftest.py b/tests/test_asyncio/conftest.py index 41b47b2268..4681d4eb42 100644 --- a/tests/test_asyncio/conftest.py +++ b/tests/test_asyncio/conftest.py @@ -1,6 +1,7 @@ import random from contextlib import asynccontextmanager as _asynccontextmanager from typing import Union +from unittest import mock import pytest import pytest_asyncio @@ -13,8 +14,6 @@ from redis.backoff import NoBackoff from tests.conftest import REDIS_INFO -from .compat import mock - async def _get_info(redis_url): client = redis.Redis.from_url(redis_url) diff --git a/tests/test_asyncio/test_cluster.py b/tests/test_asyncio/test_cluster.py index f3b76b80c9..15477ab63d 100644 --- a/tests/test_asyncio/test_cluster.py +++ b/tests/test_asyncio/test_cluster.py @@ -4,6 +4,7 @@ import ssl import warnings from typing import Any, Awaitable, Callable, Dict, List, Optional, Type, Union +from unittest import mock from urllib.parse import urlparse import pytest @@ -39,7 +40,7 @@ ) from ..ssl_utils import get_ssl_filename -from .compat import aclosing, mock +from .compat import aclosing pytestmark = pytest.mark.onlycluster diff --git a/tests/test_asyncio/test_connection.py b/tests/test_asyncio/test_connection.py index e584fc6999..c3ad51ab1d 100644 --- a/tests/test_asyncio/test_connection.py +++ b/tests/test_asyncio/test_connection.py @@ -1,6 +1,7 @@ import asyncio import socket import types +from unittest import mock from unittest.mock import patch import pytest @@ -24,7 +25,6 @@ from redis.utils import HIREDIS_AVAILABLE from tests.conftest import skip_if_server_version_lt -from .compat import mock from .mocks import MockStream diff --git a/tests/test_asyncio/test_connection_pool.py b/tests/test_asyncio/test_connection_pool.py index 2f5bbfb621..fc5f215190 100644 --- a/tests/test_asyncio/test_connection_pool.py +++ b/tests/test_asyncio/test_connection_pool.py @@ -1,5 +1,6 @@ import asyncio import re +from unittest import mock import pytest import pytest_asyncio @@ -7,7 +8,7 @@ from redis.asyncio.connection import Connection, to_bool from tests.conftest import skip_if_redis_enterprise, skip_if_server_version_lt -from .compat import aclosing, mock +from .compat import aclosing from .conftest import asynccontextmanager from .test_pubsub import wait_for_message diff --git a/tests/test_asyncio/test_pipeline.py b/tests/test_asyncio/test_pipeline.py index 31759d84a3..606f22f8cc 100644 --- a/tests/test_asyncio/test_pipeline.py +++ b/tests/test_asyncio/test_pipeline.py @@ -1,8 +1,10 @@ +from unittest import mock + import pytest import redis from tests.conftest import skip_if_server_version_lt -from .compat import aclosing, mock +from .compat import aclosing from .conftest import wait_for_command diff --git a/tests/test_asyncio/test_pubsub.py b/tests/test_asyncio/test_pubsub.py index 13a6158b40..d1709f2d11 100644 --- a/tests/test_asyncio/test_pubsub.py +++ b/tests/test_asyncio/test_pubsub.py @@ -12,6 +12,8 @@ else: from async_timeout import timeout as async_timeout +from unittest import mock + import pytest import pytest_asyncio import redis.asyncio as redis @@ -20,7 +22,7 @@ from redis.utils import HIREDIS_AVAILABLE from tests.conftest import get_protocol_version, skip_if_server_version_lt -from .compat import aclosing, create_task, mock +from .compat import aclosing, create_task def with_timeout(t): diff --git a/tests/test_asyncio/test_sentinel_managed_connection.py b/tests/test_asyncio/test_sentinel_managed_connection.py index cae4b9581f..01f717ee38 100644 --- a/tests/test_asyncio/test_sentinel_managed_connection.py +++ b/tests/test_asyncio/test_sentinel_managed_connection.py @@ -1,12 +1,11 @@ import socket +from unittest import mock import pytest from redis.asyncio.retry import Retry from redis.asyncio.sentinel import SentinelManagedConnection from redis.backoff import NoBackoff -from .compat import mock - pytestmark = pytest.mark.asyncio