|
3 | 3 | import pytest
|
4 | 4 | import random
|
5 | 5 | import redis
|
6 |
| -from distutils.version import StrictVersion |
| 6 | +from packaging.version import Version |
7 | 7 | from redis.connection import parse_url
|
8 | 8 | from unittest.mock import Mock
|
9 | 9 | from urllib.parse import urlparse
|
@@ -44,15 +44,15 @@ def pytest_sessionstart(session):
|
44 | 44 |
|
45 | 45 | def skip_if_server_version_lt(min_version):
|
46 | 46 | redis_version = REDIS_INFO["version"]
|
47 |
| - check = StrictVersion(redis_version) < StrictVersion(min_version) |
| 47 | + check = Version(redis_version) < Version(min_version) |
48 | 48 | return pytest.mark.skipif(
|
49 | 49 | check,
|
50 | 50 | reason="Redis version required >= {}".format(min_version))
|
51 | 51 |
|
52 | 52 |
|
53 | 53 | def skip_if_server_version_gte(min_version):
|
54 | 54 | redis_version = REDIS_INFO["version"]
|
55 |
| - check = StrictVersion(redis_version) >= StrictVersion(min_version) |
| 55 | + check = Version(redis_version) >= Version(min_version) |
56 | 56 | return pytest.mark.skipif(
|
57 | 57 | check,
|
58 | 58 | reason="Redis version required < {}".format(min_version))
|
@@ -183,7 +183,7 @@ def wait_for_command(client, monitor, command):
|
183 | 183 | # if we find a command with our key before the command we're waiting
|
184 | 184 | # for, something went wrong
|
185 | 185 | redis_version = REDIS_INFO["version"]
|
186 |
| - if StrictVersion(redis_version) >= StrictVersion('5.0.0'): |
| 186 | + if Version(redis_version) >= Version('5.0.0'): |
187 | 187 | id_str = str(client.client_id())
|
188 | 188 | else:
|
189 | 189 | id_str = '%08x' % random.randrange(2**32)
|
|
0 commit comments