Skip to content

Commit f2f470e

Browse files
committed
constant for redis 6 RC candidates in tests.
replace with a '6.0.0' literal when Redis 6 is GA
1 parent b9544af commit f2f470e

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
from distutils.version import StrictVersion
88

99

10+
# redis 6 release candidates report a version number of 5.9.x. Use this
11+
# constant for skip_if decorators as a placeholder until 6.0.0 is officially
12+
# released
13+
REDIS_6_VERSION = '5.9.0'
14+
15+
1016
REDIS_INFO = {}
1117
default_redis_url = "redis://localhost:6379/9"
1218

tests/test_commands.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from redis import exceptions
1313

1414
from .conftest import (skip_if_server_version_lt, skip_if_server_version_gte,
15-
skip_unless_arch_bits)
15+
skip_unless_arch_bits, REDIS_6_VERSION)
1616

1717

1818
@pytest.fixture()
@@ -65,19 +65,19 @@ def test_command_on_invalid_key_type(self, r):
6565
r['a']
6666

6767
# SERVER INFORMATION
68-
@skip_if_server_version_lt('5.9.101')
68+
@skip_if_server_version_lt(REDIS_6_VERSION)
6969
def test_acl_cat_no_category(self, r):
7070
categories = r.acl_cat()
7171
assert isinstance(categories, list)
7272
assert 'read' in categories
7373

74-
@skip_if_server_version_lt('5.9.101')
74+
@skip_if_server_version_lt(REDIS_6_VERSION)
7575
def test_acl_cat_with_category(self, r):
7676
commands = r.acl_cat('read')
7777
assert isinstance(commands, list)
7878
assert 'get' in commands
7979

80-
@skip_if_server_version_lt('5.9.101')
80+
@skip_if_server_version_lt(REDIS_6_VERSION)
8181
def test_acl_deluser(self, r, request):
8282
username = 'redis-py-user'
8383

@@ -90,12 +90,12 @@ def teardown():
9090
assert r.acl_setuser(username, enabled=False, reset=True)
9191
assert r.acl_deluser(username) == 1
9292

93-
@skip_if_server_version_lt('5.9.101')
93+
@skip_if_server_version_lt(REDIS_6_VERSION)
9494
def test_acl_genpass(self, r):
9595
password = r.acl_genpass()
9696
assert isinstance(password, basestring)
9797

98-
@skip_if_server_version_lt('5.9.101')
98+
@skip_if_server_version_lt(REDIS_6_VERSION)
9999
def test_acl_getuser_setuser(self, r, request):
100100
username = 'redis-py-user'
101101

@@ -183,7 +183,7 @@ def teardown():
183183
hashed_passwords=['-' + hashed_password])
184184
assert len(r.acl_getuser(username)['passwords']) == 1
185185

186-
@skip_if_server_version_lt('5.9.101')
186+
@skip_if_server_version_lt(REDIS_6_VERSION)
187187
def test_acl_list(self, r, request):
188188
username = 'redis-py-user'
189189

@@ -195,7 +195,7 @@ def teardown():
195195
users = r.acl_list()
196196
assert 'user %s off -@all' % username in users
197197

198-
@skip_if_server_version_lt('5.9.101')
198+
@skip_if_server_version_lt(REDIS_6_VERSION)
199199
def test_acl_setuser_categories_without_prefix_fails(self, r, request):
200200
username = 'redis-py-user'
201201

@@ -206,7 +206,7 @@ def teardown():
206206
with pytest.raises(exceptions.DataError):
207207
r.acl_setuser(username, categories=['list'])
208208

209-
@skip_if_server_version_lt('5.9.101')
209+
@skip_if_server_version_lt(REDIS_6_VERSION)
210210
def test_acl_setuser_commands_without_prefix_fails(self, r, request):
211211
username = 'redis-py-user'
212212

@@ -217,7 +217,7 @@ def teardown():
217217
with pytest.raises(exceptions.DataError):
218218
r.acl_setuser(username, commands=['get'])
219219

220-
@skip_if_server_version_lt('5.9.101')
220+
@skip_if_server_version_lt(REDIS_6_VERSION)
221221
def test_acl_setuser_add_passwords_and_nopass_fails(self, r, request):
222222
username = 'redis-py-user'
223223

@@ -228,13 +228,13 @@ def teardown():
228228
with pytest.raises(exceptions.DataError):
229229
r.acl_setuser(username, passwords='+mypass', nopass=True)
230230

231-
@skip_if_server_version_lt('5.9.101')
231+
@skip_if_server_version_lt(REDIS_6_VERSION)
232232
def test_acl_users(self, r):
233233
users = r.acl_users()
234234
assert isinstance(users, list)
235235
assert len(users) > 0
236236

237-
@skip_if_server_version_lt('5.9.101')
237+
@skip_if_server_version_lt(REDIS_6_VERSION)
238238
def test_acl_whoami(self, r):
239239
username = r.acl_whoami()
240240
assert isinstance(username, basestring)
@@ -867,7 +867,7 @@ def test_set_multipleoptions(self, r):
867867
assert r.set('a', '1', xx=True, px=10000)
868868
assert 0 < r.ttl('a') <= 10
869869

870-
@skip_if_server_version_lt('5.9.0') # 6.0-rc1
870+
@skip_if_server_version_lt(REDIS_6_VERSION)
871871
def test_set_keepttl(self, r):
872872
r['a'] = 'val'
873873
assert r.set('a', '1', xx=True, px=10000)
@@ -1073,7 +1073,7 @@ def test_scan(self, r):
10731073
_, keys = r.scan(match='a')
10741074
assert set(keys) == {b'a'}
10751075

1076-
@skip_if_server_version_lt('5.9.101')
1076+
@skip_if_server_version_lt(REDIS_6_VERSION)
10771077
def test_scan_type(self, r):
10781078
r.sadd('a-set', 1)
10791079
r.hset('a-hash', 'foo', 2)

tests/test_connection_pool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from threading import Thread
99
from redis.connection import ssl_available, to_bool
10-
from .conftest import skip_if_server_version_lt, _get_client
10+
from .conftest import skip_if_server_version_lt, _get_client, REDIS_6_VERSION
1111
from .test_pubsub import wait_for_message
1212

1313

@@ -215,7 +215,7 @@ def test_port(self):
215215
'password': None,
216216
}
217217

218-
@skip_if_server_version_lt('5.9.101')
218+
@skip_if_server_version_lt(REDIS_6_VERSION)
219219
def test_username(self):
220220
pool = redis.ConnectionPool.from_url('redis://myuser:@localhost')
221221
assert pool.connection_class == redis.Connection
@@ -227,7 +227,7 @@ def test_username(self):
227227
'password': None,
228228
}
229229

230-
@skip_if_server_version_lt('5.9.101')
230+
@skip_if_server_version_lt(REDIS_6_VERSION)
231231
def test_quoted_username(self):
232232
pool = redis.ConnectionPool.from_url(
233233
'redis://%2Fmyuser%2F%2B name%3D%24+:@localhost',
@@ -265,7 +265,7 @@ def test_quoted_password(self):
265265
'password': '/mypass/+ word=$+',
266266
}
267267

268-
@skip_if_server_version_lt('5.9.101')
268+
@skip_if_server_version_lt(REDIS_6_VERSION)
269269
def test_username_and_password(self):
270270
pool = redis.ConnectionPool.from_url('redis://myuser:mypass@localhost')
271271
assert pool.connection_class == redis.Connection
@@ -408,7 +408,7 @@ def test_defaults(self):
408408
'password': None,
409409
}
410410

411-
@skip_if_server_version_lt('5.9.101')
411+
@skip_if_server_version_lt(REDIS_6_VERSION)
412412
def test_username(self):
413413
pool = redis.ConnectionPool.from_url('unix://myuser:@/socket')
414414
assert pool.connection_class == redis.UnixDomainSocketConnection
@@ -419,7 +419,7 @@ def test_username(self):
419419
'password': None,
420420
}
421421

422-
@skip_if_server_version_lt('5.9.101')
422+
@skip_if_server_version_lt(REDIS_6_VERSION)
423423
def test_quoted_username(self):
424424
pool = redis.ConnectionPool.from_url(
425425
'unix://%2Fmyuser%2F%2B name%3D%24+:@/socket',

0 commit comments

Comments
 (0)