Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
- 3.7
- 3.8
- 3.9
- "3.10"
- "3.11"
- "3.12"

services:
redis:
Expand Down
4 changes: 2 additions & 2 deletions aioredlock/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import re
import time
from distutils.version import StrictVersion
from packaging.version import parse as parse_version
from itertools import groupby

import aioredis
Expand Down Expand Up @@ -110,7 +110,7 @@ async def _create_redis_pool(*args, **kwargs):
aioredis.create_pool(*args, **kwargs)
"""

if StrictVersion(aioredis.__version__) >= StrictVersion('1.0.0'): # pragma no cover
if parse_version(aioredis.__version__) >= parse_version('1.0.0'): # pragma no cover
return await aioredis.create_redis_pool(*args, **kwargs)
else: # pragma no cover
return await aioredis.create_pool(*args, **kwargs)
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],

keywords='redis redlock distributed locks asyncio',

packages=find_packages(),

python_requires='>=3.6',
install_requires=['aioredis<2.0.0', 'attrs >= 17.4.0'],
install_requires=['aioredis<2.0.0', 'attrs >= 17.4.0', 'packaging'],
extras_require={
'test': ['pytest==6.1.0', 'pytest-asyncio', 'pytest-mock', 'pytest-cov', 'flake8'],
'cicd': ['codecov'],
Expand Down
6 changes: 3 additions & 3 deletions tests/ut/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ def test_initialization(self, redis_two_connections):
assert len(redis.instances) == 2

parametrize_methods = pytest.mark.parametrize("method_name, call_args", [
('set_lock', {'keys': ['resource'], 'args':['lock_id', 10000]}),
('unset_lock', {'keys': ['resource'], 'args':['lock_id']}),
('get_lock_ttl', {'keys': ['resource'], 'args':['lock_id']}),
('set_lock', {'keys': ['resource'], 'args': ['lock_id', 10000]}),
('unset_lock', {'keys': ['resource'], 'args': ['lock_id']}),
('get_lock_ttl', {'keys': ['resource'], 'args': ['lock_id']}),
])

@pytest.mark.asyncio
Expand Down