Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.25.0: TypeError: FakeBaseConnectionMixin.__init__() missing 2 required keyword-only arguments: 'version' and 'server_type' #334

Closed
9128305 opened this issue Sep 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@9128305
Copy link

9128305 commented Sep 30, 2024

Describe the bug
Hi, this combination of dependencies is working:

django-redis                  5.4.0
fakeredis                     2.24.1
hiredis                       3.0.0
redis                         5.1.0

fakeredis 2.25.0 breaks my django tests with the following error:

TypeError: FakeBaseConnectionMixin.__init__() missing 2 required keyword-only arguments: 'version' and 'server_type'

To Reproduce

from django.core.cache import caches
caches['default'].get('key')

Traceback:

.venv/lib/python3.11/site-packages/django_redis/cache.py:92: in get
    value = self._get(key, default, version, client)
.venv/lib/python3.11/site-packages/django_redis/cache.py:29: in _decorator
    return method(self, *args, **kwargs)
.venv/lib/python3.11/site-packages/django_redis/cache.py:99: in _get
    return self.client.get(key, default=default, version=version, client=client)
.venv/lib/python3.11/site-packages/django_redis/client/default.py:258: in get
    value = client.get(key)
.venv/lib/python3.11/site-packages/redis/commands/core.py:1822: in get
    return self.execute_command("GET", name, keys=[name])
.venv/lib/python3.11/site-packages/redis/client.py:559: in execute_command
    return self._execute_command(*args, **options)
.venv/lib/python3.11/site-packages/redis/client.py:565: in _execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
.venv/lib/python3.11/site-packages/redis/connection.py:1418: in get_connection
    connection = self.make_connection()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[TypeError("FakeBaseConnectionMixin.__init__() missing 2 required keyword-only arguments: 'version' and 'server_type'") raised in repr()] ConnectionPool object at 0x7ebef80ed9d0>

    def make_connection(self) -> "ConnectionInterface":
        "Create a new connection"
        if self._created_connections >= self.max_connections:
            raise ConnectionError("Too many connections")
        self._created_connections += 1

        if self.cache is not None:
            return CacheProxyConnection(
                self.connection_class(**self.connection_kwargs), self.cache, self._lock
            )

>       return self.connection_class(**self.connection_kwargs)
E       TypeError: FakeBaseConnectionMixin.__init__() missing 2 required keyword-only arguments: 'version' and 'server_type'

.venv/lib/python3.11/site-packages/redis/connection.py:1464: TypeError

Minimal reproducer:

import redis
from fakeredis import FakeConnection

client = redis.Redis(connection_pool=redis.ConnectionPool(connection_class=FakeConnection))

client.get('key')

Expected behavior
No errors

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • python version: 3.11.8
  • redis-py version: 5.1.0
  • full requirements.txt?

Additional context
Add any other context about the problem here.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@9128305 9128305 added the bug Something isn't working label Sep 30, 2024
@cunla
Copy link
Owner

cunla commented Sep 30, 2024

Thanks for reporting this. I'll address this shortly

@cunla cunla closed this as completed in 53624f3 Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants