Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the REDIS_6_VERSION placeholder #1582

Merged
merged 1 commit into from
Oct 11, 2021
Merged
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
6 changes: 0 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
from urllib.parse import urlparse


# redis 6 release candidates report a version number of 5.9.x. Use this
# constant for skip_if decorators as a placeholder until 6.0.0 is officially
# released
REDIS_6_VERSION = '5.9.0'


REDIS_INFO = {}
default_redis_url = "redis://localhost:6379/9"

Expand Down
31 changes: 15 additions & 16 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from .conftest import (
_get_client,
REDIS_6_VERSION,
skip_if_server_version_gte,
skip_if_server_version_lt,
skip_unless_arch_bits,
Expand Down Expand Up @@ -68,19 +67,19 @@ def test_command_on_invalid_key_type(self, r):
r['a']

# SERVER INFORMATION
@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_cat_no_category(self, r):
categories = r.acl_cat()
assert isinstance(categories, list)
assert 'read' in categories

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_cat_with_category(self, r):
commands = r.acl_cat('read')
assert isinstance(commands, list)
assert 'get' in commands

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_deluser(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_genpass(self, r):
password = r.acl_genpass()
assert isinstance(password, str)
Expand All @@ -117,7 +116,7 @@ def test_acl_genpass(self, r):
r.acl_genpass(555)
assert isinstance(password, str)

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_getuser_setuser(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_help(self, r):
res = r.acl_help()
assert isinstance(res, list)
assert len(res) != 0

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_list(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_log(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_setuser_categories_without_prefix_fails(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_setuser_commands_without_prefix_fails(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_setuser_add_passwords_and_nopass_fails(self, r, request):
username = 'redis-py-user'

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_users(self, r):
users = r.acl_users()
assert isinstance(users, list)
assert len(users) > 0

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_acl_whoami(self, r):
username = r.acl_whoami()
assert isinstance(username, str)
Expand Down Expand Up @@ -1129,7 +1128,7 @@ def test_set_multipleoptions(self, r):
assert r.set('a', '1', xx=True, px=10000)
assert 0 < r.ttl('a') <= 10

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_set_keepttl(self, r):
r['a'] = 'val'
assert r.set('a', '1', xx=True, px=10000)
Expand Down Expand Up @@ -1443,7 +1442,7 @@ def test_scan(self, r):
_, keys = r.scan(match='a')
assert set(keys) == {b'a'}

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_scan_type(self, r):
r.sadd('a-set', 1)
r.hset('a-hash', 'foo', 2)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from threading import Thread
from redis.connection import ssl_available, to_bool
from .conftest import skip_if_server_version_lt, _get_client, REDIS_6_VERSION
from .conftest import skip_if_server_version_lt, _get_client
from .test_pubsub import wait_for_message


Expand Down Expand Up @@ -200,7 +200,7 @@ def test_port(self):
'port': 6380,
}

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_username(self):
pool = redis.ConnectionPool.from_url('redis://myuser:@localhost')
assert pool.connection_class == redis.Connection
Expand All @@ -209,7 +209,7 @@ def test_username(self):
'username': 'myuser',
}

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

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_username_and_password(self):
pool = redis.ConnectionPool.from_url('redis://myuser:mypass@localhost')
assert pool.connection_class == redis.Connection
Expand Down Expand Up @@ -349,7 +349,7 @@ def test_defaults(self):
'path': '/socket',
}

@skip_if_server_version_lt(REDIS_6_VERSION)
@skip_if_server_version_lt("6.0.0")
def test_username(self):
pool = redis.ConnectionPool.from_url('unix://myuser:@/socket')
assert pool.connection_class == redis.UnixDomainSocketConnection
Expand All @@ -358,7 +358,7 @@ def test_username(self):
'username': 'myuser',
}

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