diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 477b5c06..6c4a4843 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,38 +18,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] - redis-py: ["4.1.2", "4.2.2"] + python-version: ["3.8", "3.9", "3.10"] + redis-py: ["4.1.2", "4.3.1"] aioredis: ["2.0.1"] - exclude: - - python-version: "3.7" - redis-py: "4.2.2" - aioredis: "2.0.1" - - python-version: "3.8" - redis-py: "4.2.2" - aioredis: "2.0.1" include: - - python-version: "3.9" - redis-py: "4.2.*" - aioredis: "1.3.1" - python-version: "3.10" redis-py: "2.10.6" aioredis: "1.3.1" - - python-version: "3.10" - redis-py: "3.0.1" - aioredis: "1.3.1" - - python-version: "3.10" - redis-py: "3.1.0" - aioredis: "1.3.1" - - python-version: "3.10" - redis-py: "3.2.1" - aioredis: "1.3.1" - - python-version: "3.10" - redis-py: "3.3.11" - aioredis: "1.3.1" - - python-version: "3.10" - redis-py: "3.4.1" - aioredis: "1.3.1" - python-version: "3.10" redis-py: "3.5.3" aioredis: "1.3.1" @@ -57,10 +32,7 @@ jobs: redis-py: "4.0.1" aioredis: "1.3.1" - python-version: "3.10" - redis-py: "4.1.*" - aioredis: "2.0.1" - - python-version: "3.10" - redis-py: "4.2.*" + redis-py: "4.2.2" aioredis: "2.0.1" coverage: yes services: diff --git a/fakeredis/__init__.py b/fakeredis/__init__.py index 99a99e9e..d5b49469 100644 --- a/fakeredis/__init__.py +++ b/fakeredis/__init__.py @@ -1,4 +1,4 @@ from ._server import FakeServer, FakeRedis, FakeStrictRedis, FakeConnection # noqa: F401 -__version__ = '1.7.4' +__version__ = '1.7.5' diff --git a/fakeredis/_server.py b/fakeredis/_server.py index ac58966d..99d75adf 100644 --- a/fakeredis/_server.py +++ b/fakeredis/_server.py @@ -3,7 +3,6 @@ import inspect import itertools import logging -import math import pickle import queue import random @@ -15,6 +14,7 @@ from collections import defaultdict from collections.abc import MutableMapping +import math import redis import six @@ -87,7 +87,7 @@ FLAG_NO_SCRIPT = 's' # Command not allowed in scripts # This needs to be grabbed early to avoid breaking tests that mock redis.Redis. -_ORIG_SIG = inspect.signature(redis.Redis) +# _ORIG_SIG = inspect.signature(redis.Redis) class SimpleString: @@ -2799,20 +2799,23 @@ class FakeRedisMixin: def __init__(self, *args, server=None, connected=True, **kwargs): # Interpret the positional and keyword arguments according to the # version of redis in use. - bound = _ORIG_SIG.bind(*args, **kwargs) - bound.apply_defaults() - if not bound.arguments['connection_pool']: - charset = bound.arguments['charset'] - errors = bound.arguments['errors'] + default_args = inspect.signature(redis.Redis.__init__).parameters.values() + kwds = {p.name: p.default for p in default_args if p.default != inspect._empty} + kwds.update(kwargs) + # bound = _ORIG_SIG.bind(*args, **params) + # kwds = bound.arguments['kwds'] + if not kwds['connection_pool']: + charset = kwds['charset'] + errors = kwds['errors'] # Adapted from redis-py if charset is not None: warnings.warn(DeprecationWarning( '"charset" is deprecated. Use "encoding" instead')) - bound.arguments['encoding'] = charset + kwds['encoding'] = charset if errors is not None: warnings.warn(DeprecationWarning( '"errors" is deprecated. Use "encoding_errors" instead')) - bound.arguments['encoding_errors'] = errors + kwds['encoding_errors'] = errors if server is None: server = FakeServer() @@ -2835,10 +2838,10 @@ def __init__(self, *args, server=None, connected=True, **kwargs): 'client_name' ] for arg in conn_pool_args: - if arg in bound.arguments: - kwargs[arg] = bound.arguments[arg] - bound.arguments['connection_pool'] = redis.connection.ConnectionPool(**kwargs) - super().__init__(*bound.args, **bound.kwargs) + if arg in kwds: + kwargs[arg] = kwds[arg] + kwds['connection_pool'] = redis.connection.ConnectionPool(**kwargs) + super().__init__(*args, **kwds) @classmethod def from_url(cls, *args, **kwargs): diff --git a/requirements-dev.txt b/requirements-dev.txt index 852007a1..13decaf5 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -invoke==1.7.0 +invoke==1.7.1 wheel==0.37.1 tox==3.25.0 twine==4.0.0 diff --git a/requirements.txt b/requirements.txt index 978939c0..76b1ab33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,11 +2,11 @@ aioredis==2.0.1 async-timeout==4.0.2 attrs==21.4.0 deprecated==1.2.13 -hypothesis==6.45.0 +hypothesis==6.46.3 lupa==1.13 packaging==21.3 -redis==4.2.2 +redis==4.3.1 six==1.16.0 typing-extensions==4.2.0 -wrapt==1.14.0 +wrapt==1.14.1 zipp==3.8.0 diff --git a/setup.cfg b/setup.cfg index d1afa418..483d28e7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,6 @@ classifiers = Development Status :: 5 - Production/Stable License :: OSI Approved :: BSD License Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -24,13 +23,10 @@ classifiers = packages = fakeredis install_requires = packaging - # Minor version updates to redis tend to break fakeredis. If you - # need to use fakeredis with a newer redis, please submit a PR that - # relaxes this restriction and adds it to the Github Actions tests. - redis<=4.2.2 + redis<=4.3.1 six>=1.12 sortedcontainers -python_requires = >=3.5 +python_requires = >=3.7 [options.extras_require] lua = @@ -38,7 +34,6 @@ lua = aioredis = aioredis -# Tool configurations below here [flake8] max-line-length = 119