Skip to content

Commit 22f677f

Browse files
authored
Removing the REDIS_6_VERSION placeholder (#1582)
1 parent 9419f1d commit 22f677f

File tree

3 files changed

+21
-28
lines changed

3 files changed

+21
-28
lines changed

tests/conftest.py

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
from urllib.parse import urlparse
1010

1111

12-
# redis 6 release candidates report a version number of 5.9.x. Use this
13-
# constant for skip_if decorators as a placeholder until 6.0.0 is officially
14-
# released
15-
REDIS_6_VERSION = '5.9.0'
16-
17-
1812
REDIS_INFO = {}
1913
default_redis_url = "redis://localhost:6379/9"
2014

tests/test_commands.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from .conftest import (
1313
_get_client,
14-
REDIS_6_VERSION,
1514
skip_if_server_version_gte,
1615
skip_if_server_version_lt,
1716
skip_unless_arch_bits,
@@ -68,19 +67,19 @@ def test_command_on_invalid_key_type(self, r):
6867
r['a']
6968

7069
# SERVER INFORMATION
71-
@skip_if_server_version_lt(REDIS_6_VERSION)
70+
@skip_if_server_version_lt("6.0.0")
7271
def test_acl_cat_no_category(self, r):
7372
categories = r.acl_cat()
7473
assert isinstance(categories, list)
7574
assert 'read' in categories
7675

77-
@skip_if_server_version_lt(REDIS_6_VERSION)
76+
@skip_if_server_version_lt("6.0.0")
7877
def test_acl_cat_with_category(self, r):
7978
commands = r.acl_cat('read')
8079
assert isinstance(commands, list)
8180
assert 'get' in commands
8281

83-
@skip_if_server_version_lt(REDIS_6_VERSION)
82+
@skip_if_server_version_lt("6.0.0")
8483
def test_acl_deluser(self, r, request):
8584
username = 'redis-py-user'
8685

@@ -104,7 +103,7 @@ def teardown():
104103
assert r.acl_getuser(users[3]) is None
105104
assert r.acl_getuser(users[4]) is None
106105

107-
@skip_if_server_version_lt(REDIS_6_VERSION)
106+
@skip_if_server_version_lt("6.0.0")
108107
def test_acl_genpass(self, r):
109108
password = r.acl_genpass()
110109
assert isinstance(password, str)
@@ -117,7 +116,7 @@ def test_acl_genpass(self, r):
117116
r.acl_genpass(555)
118117
assert isinstance(password, str)
119118

120-
@skip_if_server_version_lt(REDIS_6_VERSION)
119+
@skip_if_server_version_lt("6.0.0")
121120
def test_acl_getuser_setuser(self, r, request):
122121
username = 'redis-py-user'
123122

@@ -204,13 +203,13 @@ def teardown():
204203
hashed_passwords=['-' + hashed_password])
205204
assert len(r.acl_getuser(username)['passwords']) == 1
206205

207-
@skip_if_server_version_lt(REDIS_6_VERSION)
206+
@skip_if_server_version_lt("6.0.0")
208207
def test_acl_help(self, r):
209208
res = r.acl_help()
210209
assert isinstance(res, list)
211210
assert len(res) != 0
212211

213-
@skip_if_server_version_lt(REDIS_6_VERSION)
212+
@skip_if_server_version_lt("6.0.0")
214213
def test_acl_list(self, r, request):
215214
username = 'redis-py-user'
216215

@@ -222,7 +221,7 @@ def teardown():
222221
users = r.acl_list()
223222
assert len(users) == 2
224223

225-
@skip_if_server_version_lt(REDIS_6_VERSION)
224+
@skip_if_server_version_lt("6.0.0")
226225
def test_acl_log(self, r, request):
227226
username = 'redis-py-user'
228227

@@ -257,7 +256,7 @@ def teardown():
257256
assert 'client-info' in r.acl_log(count=1)[0]
258257
assert r.acl_log_reset()
259258

260-
@skip_if_server_version_lt(REDIS_6_VERSION)
259+
@skip_if_server_version_lt("6.0.0")
261260
def test_acl_setuser_categories_without_prefix_fails(self, r, request):
262261
username = 'redis-py-user'
263262

@@ -268,7 +267,7 @@ def teardown():
268267
with pytest.raises(exceptions.DataError):
269268
r.acl_setuser(username, categories=['list'])
270269

271-
@skip_if_server_version_lt(REDIS_6_VERSION)
270+
@skip_if_server_version_lt("6.0.0")
272271
def test_acl_setuser_commands_without_prefix_fails(self, r, request):
273272
username = 'redis-py-user'
274273

@@ -279,7 +278,7 @@ def teardown():
279278
with pytest.raises(exceptions.DataError):
280279
r.acl_setuser(username, commands=['get'])
281280

282-
@skip_if_server_version_lt(REDIS_6_VERSION)
281+
@skip_if_server_version_lt("6.0.0")
283282
def test_acl_setuser_add_passwords_and_nopass_fails(self, r, request):
284283
username = 'redis-py-user'
285284

@@ -290,13 +289,13 @@ def teardown():
290289
with pytest.raises(exceptions.DataError):
291290
r.acl_setuser(username, passwords='+mypass', nopass=True)
292291

293-
@skip_if_server_version_lt(REDIS_6_VERSION)
292+
@skip_if_server_version_lt("6.0.0")
294293
def test_acl_users(self, r):
295294
users = r.acl_users()
296295
assert isinstance(users, list)
297296
assert len(users) > 0
298297

299-
@skip_if_server_version_lt(REDIS_6_VERSION)
298+
@skip_if_server_version_lt("6.0.0")
300299
def test_acl_whoami(self, r):
301300
username = r.acl_whoami()
302301
assert isinstance(username, str)
@@ -1137,7 +1136,7 @@ def test_set_multipleoptions(self, r):
11371136
assert r.set('a', '1', xx=True, px=10000)
11381137
assert 0 < r.ttl('a') <= 10
11391138

1140-
@skip_if_server_version_lt(REDIS_6_VERSION)
1139+
@skip_if_server_version_lt("6.0.0")
11411140
def test_set_keepttl(self, r):
11421141
r['a'] = 'val'
11431142
assert r.set('a', '1', xx=True, px=10000)
@@ -1451,7 +1450,7 @@ def test_scan(self, r):
14511450
_, keys = r.scan(match='a')
14521451
assert set(keys) == {b'a'}
14531452

1454-
@skip_if_server_version_lt(REDIS_6_VERSION)
1453+
@skip_if_server_version_lt("6.0.0")
14551454
def test_scan_type(self, r):
14561455
r.sadd('a-set', 1)
14571456
r.hset('a-hash', 'foo', 2)

tests/test_connection_pool.py

+6-6
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, REDIS_6_VERSION
10+
from .conftest import skip_if_server_version_lt, _get_client
1111
from .test_pubsub import wait_for_message
1212

1313

@@ -200,7 +200,7 @@ def test_port(self):
200200
'port': 6380,
201201
}
202202

203-
@skip_if_server_version_lt(REDIS_6_VERSION)
203+
@skip_if_server_version_lt("6.0.0")
204204
def test_username(self):
205205
pool = redis.ConnectionPool.from_url('redis://myuser:@localhost')
206206
assert pool.connection_class == redis.Connection
@@ -209,7 +209,7 @@ def test_username(self):
209209
'username': 'myuser',
210210
}
211211

212-
@skip_if_server_version_lt(REDIS_6_VERSION)
212+
@skip_if_server_version_lt("6.0.0")
213213
def test_quoted_username(self):
214214
pool = redis.ConnectionPool.from_url(
215215
'redis://%2Fmyuser%2F%2B name%3D%24+:@localhost')
@@ -236,7 +236,7 @@ def test_quoted_password(self):
236236
'password': '/mypass/+ word=$+',
237237
}
238238

239-
@skip_if_server_version_lt(REDIS_6_VERSION)
239+
@skip_if_server_version_lt("6.0.0")
240240
def test_username_and_password(self):
241241
pool = redis.ConnectionPool.from_url('redis://myuser:mypass@localhost')
242242
assert pool.connection_class == redis.Connection
@@ -349,7 +349,7 @@ def test_defaults(self):
349349
'path': '/socket',
350350
}
351351

352-
@skip_if_server_version_lt(REDIS_6_VERSION)
352+
@skip_if_server_version_lt("6.0.0")
353353
def test_username(self):
354354
pool = redis.ConnectionPool.from_url('unix://myuser:@/socket')
355355
assert pool.connection_class == redis.UnixDomainSocketConnection
@@ -358,7 +358,7 @@ def test_username(self):
358358
'username': 'myuser',
359359
}
360360

361-
@skip_if_server_version_lt(REDIS_6_VERSION)
361+
@skip_if_server_version_lt("6.0.0")
362362
def test_quoted_username(self):
363363
pool = redis.ConnectionPool.from_url(
364364
'unix://%2Fmyuser%2F%2B name%3D%24+:@/socket')

0 commit comments

Comments
 (0)