How to use the aioredlock.redis.Redis function in aioredlock

To help you get started, we’ve selected a few aioredlock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joanvila / aioredlock / tests / ut / test_redis.py View on Github external
def test_initialization(self, redis_two_connections):
        with patch("aioredlock.redis.Instance.__init__") as mock_instance:
            mock_instance.return_value = None

            redis = Redis(redis_two_connections)

            calls = [
                call({'host': 'localhost', 'port': 6379}),
                call({'host': '127.0.0.1', 'port': 6378})
            ]
            mock_instance.assert_has_calls(calls)
            assert len(redis.instances) == 2
github joanvila / aioredlock / tests / ut / test_redis.py View on Github external
def mock_redis_three_instances(redis_three_connections):
    pool = FakePool()
    redis = Redis(redis_three_connections)

    for instance in redis.instances:
        instance._pool = pool

    yield redis, pool
github joanvila / aioredlock / tests / ut / test_redis.py View on Github external
def mock_redis_two_instances(redis_two_connections):
    pool = FakePool()
    redis = Redis(redis_two_connections)

    for instance in redis.instances:
        instance._pool = pool

    yield redis, pool
github joanvila / aioredlock / aioredlock / algorithm.py View on Github external
def __attrs_post_init__(self):
        self.redis = Redis(self.redis_connections, self.lock_timeout)

aioredlock

Asyncio implemetation of Redis distributed locks

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages