diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-08-06 15:15:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 15:15:02 -0700 |
commit | 8c5a41baf0bd2a1388d601e5b49d06b91997ccb8 (patch) | |
tree | 89cad14d95927f8ea696706c2b1399dde17fa244 /tests/test_connection_pool.py | |
parent | c6f13c3b69d32257ab75ba9d824e5b555f91572c (diff) | |
download | redis-py-8c5a41baf0bd2a1388d601e5b49d06b91997ccb8.tar.gz |
Remove support for end-of-life Python 2.7 (#1318)
Remove support for end-of-life Python 2.7
Python 2.7 is end of life. It is no longer receiving bug fixes,
including for security issues. Python 2.7 went EOL on 2020-01-01. For
additional details on support Python versions, see:
Supported: https://devguide.python.org/#status-of-python-branches
EOL: https://devguide.python.org/devcycle/#end-of-life-branches
Removing support for EOL Pythons will reduce testing and maintenance
resources while allowing the library to move towards a modern Python 3
style. Python 2.7 users can continue to use the previous version of
redis-py.
Was able to simplify the code:
- Removed redis._compat module
- Removed __future__ imports
- Removed object from class definition (all classes are new style)
- Removed long (Python 3 unified numeric types)
- Removed deprecated __nonzero__ method
- Use simpler Python 3 super() syntax
- Use unified OSError exception
- Use yield from syntax
Co-authored-by: Andy McCurdy <andy@andymccurdy.com>
Diffstat (limited to 'tests/test_connection_pool.py')
-rw-r--r-- | tests/test_connection_pool.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_connection_pool.py b/tests/test_connection_pool.py index c49ecda..c26090b 100644 --- a/tests/test_connection_pool.py +++ b/tests/test_connection_pool.py @@ -1,9 +1,9 @@ import os -import mock import pytest import re import redis import time +from unittest import mock from threading import Thread from redis.connection import ssl_available, to_bool @@ -11,7 +11,7 @@ from .conftest import skip_if_server_version_lt, _get_client, REDIS_6_VERSION from .test_pubsub import wait_for_message -class DummyConnection(object): +class DummyConnection: description_format = "DummyConnection<>" def __init__(self, **kwargs): @@ -25,7 +25,7 @@ class DummyConnection(object): return False -class TestConnectionPool(object): +class TestConnectionPool: def get_pool(self, connection_kwargs=None, max_connections=None, connection_class=redis.Connection): connection_kwargs = connection_kwargs or {} @@ -93,7 +93,7 @@ class TestConnectionPool(object): assert repr(pool) == expected -class TestBlockingConnectionPool(object): +class TestBlockingConnectionPool: def get_pool(self, connection_kwargs=None, max_connections=10, timeout=20): connection_kwargs = connection_kwargs or {} pool = redis.BlockingConnectionPool(connection_class=DummyConnection, @@ -179,7 +179,7 @@ class TestBlockingConnectionPool(object): assert repr(pool) == expected -class TestConnectionPoolURLParsing(object): +class TestConnectionPoolURLParsing: def test_defaults(self): pool = redis.ConnectionPool.from_url('redis://localhost') assert pool.connection_class == redis.Connection @@ -411,7 +411,7 @@ class TestConnectionPoolURLParsing(object): ) -class TestConnectionPoolUnixSocketURLParsing(object): +class TestConnectionPoolUnixSocketURLParsing: def test_defaults(self): pool = redis.ConnectionPool.from_url('unix:///socket') assert pool.connection_class == redis.UnixDomainSocketConnection @@ -519,7 +519,7 @@ class TestConnectionPoolUnixSocketURLParsing(object): } -class TestSSLConnectionURLParsing(object): +class TestSSLConnectionURLParsing: @pytest.mark.skipif(not ssl_available, reason="SSL not installed") def test_defaults(self): pool = redis.ConnectionPool.from_url('rediss://localhost') @@ -561,7 +561,7 @@ class TestSSLConnectionURLParsing(object): assert pool.get_connection('_').check_hostname is True -class TestConnection(object): +class TestConnection: def test_on_connect_error(self): """ An error in Connection.on_connect should disconnect from the server @@ -658,7 +658,7 @@ class TestConnection(object): r.execute_command('DEBUG', 'ERROR', 'ERR invalid password') -class TestMultiConnectionClient(object): +class TestMultiConnectionClient: @pytest.fixture() def r(self, request): return _get_client(redis.Redis, @@ -671,7 +671,7 @@ class TestMultiConnectionClient(object): assert r.get('a') == b'123' -class TestHealthCheck(object): +class TestHealthCheck: interval = 60 @pytest.fixture() |