Skip to content

Commit

Permalink
Remove checking for deprecated redis-py versions
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Dec 4, 2022
1 parent 1c4d5a6 commit 6b376f4
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 53 deletions.
29 changes: 0 additions & 29 deletions test/test_mixins/test_generic_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ def test_ttl_should_return_minus_one_for_non_expiring_key(r):
assert r.ttl('foo') == -1


@testtools.run_test_if_redispy_ver('below', '3.5')
@pytest.mark.min_server('6.0')
def test_set_keepttl(r):
r.set('foo', 'bar', ex=100)
assert r.set('foo', 'baz', keepttl=True) is True
assert r.ttl('foo') == 100
assert r.get('foo') == b'baz'


def test_scan(r):
# Set up the data
for ix in range(20):
Expand Down Expand Up @@ -334,7 +325,6 @@ def test_expire_should_expire_key(r):
assert r.expire('bar', 1) is False


@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_expire_should_throw_error(r):
r.set('foo', 'bar')
assert r.get('foo') == b'bar'
Expand All @@ -348,7 +338,6 @@ def test_expire_should_throw_error(r):
r.expire('foo', 1, gt=True, lt=True)


@testtools.run_test_if_redispy_ver('above', '4.2.0')
@pytest.mark.max_server('7')
def test_expire_extra_params_return_error(r):
with pytest.raises(redis.exceptions.ResponseError):
Expand Down Expand Up @@ -517,15 +506,13 @@ def test_set_float_value(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_expire_should_not_expire__when_no_expire_is_set(r):
r.set('foo', 'bar')
assert r.get('foo') == b'bar'
assert r.expire('foo', 1, xx=True) == 0


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_expire_should_not_expire__when_expire_is_set(r):
r.set('foo', 'bar')
assert r.get('foo') == b'bar'
Expand All @@ -534,7 +521,6 @@ def test_expire_should_not_expire__when_expire_is_set(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_expire_should_expire__when_expire_is_greater(r):
r.set('foo', 'bar')
assert r.get('foo') == b'bar'
Expand All @@ -544,7 +530,6 @@ def test_expire_should_expire__when_expire_is_greater(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_expire_should_expire__when_expire_is_lessthan(r):
r.set('foo', 'bar')
assert r.get('foo') == b'bar'
Expand Down Expand Up @@ -692,20 +677,6 @@ def test_scan_iter_multiple_pages_with_match(r):
assert actual == set(all_keys)


@testtools.run_test_if_redispy_ver('below', '3.5')
@pytest.mark.min_server('6.0')
def test_scan_iter_multiple_pages_with_type(r):
all_keys = key_val_dict(size=100)
assert all(r.set(k, v) for k, v in all_keys.items())
# Now add a few keys of another type
testtools.zadd(r, 'zset1', {'otherkey': 1})
testtools.zadd(r, 'zset2', {'andanother': 1})
actual = set(r.scan_iter(_type='string'))
assert actual == set(all_keys)
actual = set(r.scan_iter(_type='ZSET'))
assert actual == {b'zset1', b'zset2'}


def test_scan_multiple_pages_with_count_arg(r):
all_keys = key_val_dict(size=100)
assert all(r.set(k, v) for k, v in all_keys.items())
Expand Down
2 changes: 0 additions & 2 deletions test/test_mixins/test_pubsub_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .. import testtools


@testtools.run_test_if_redispy_ver('above', '3')
def test_ping_pubsub(r):
p = r.pubsub()
p.subscribe('channel')
Expand Down Expand Up @@ -322,7 +321,6 @@ def publish():
assert message is None


@testtools.run_test_if_redispy_ver('above', '3.4')
@pytest.mark.fake
def test_socket_cleanup_pubsub(fake_server):
r1 = fakeredis.FakeStrictRedis(server=fake_server)
Expand Down
2 changes: 0 additions & 2 deletions test/test_mixins/test_server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from .. import testtools


@testtools.run_test_if_redispy_ver('above', '3')
def test_swapdb(r, create_redis):
r1 = create_redis(1)
r.set('foo', 'abc')
Expand All @@ -23,7 +22,6 @@ def test_swapdb(r, create_redis):
assert r1.get('baz') is None


@testtools.run_test_if_redispy_ver('above', '3')
def test_swapdb_same_db(r):
assert r.swapdb(1, 1)

Expand Down
5 changes: 0 additions & 5 deletions test/test_mixins/test_set_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ def test_sscan(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_sintercard(r):
r.sadd('foo', 'member1')
r.sadd('foo', 'member2')
Expand All @@ -357,7 +356,6 @@ def test_sintercard(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_sintercard_key_doesnt_exist(r):
r.sadd('foo', 'member1')
r.sadd('foo', 'member2')
Expand All @@ -370,7 +368,6 @@ def test_sintercard_key_doesnt_exist(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_sintercard_bytes_keys(r):
foo = os.urandom(10)
bar = os.urandom(10)
Expand All @@ -384,7 +381,6 @@ def test_sintercard_bytes_keys(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_sintercard_wrong_type(r):
testtools.zadd(r, 'foo', {'member': 1})
r.sadd('bar', 'member')
Expand All @@ -395,7 +391,6 @@ def test_sintercard_wrong_type(r):


@pytest.mark.min_server('7')
@testtools.run_test_if_redispy_ver('above', '4.2.0')
def test_sintercard_syntax_error(r):
testtools.zadd(r, 'foo', {'member': 1})
r.sadd('bar', 'member')
Expand Down
3 changes: 0 additions & 3 deletions test/test_mixins/test_sortedset_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def test_zscore_wrong_type(r):
r.zscore('foo', 'one')


@testtools.run_test_if_redispy_ver("above", "4.2.0")
def test_zmscore(r: redis.Redis) -> None:
"""When all the requested sorted-set members are in the cache, a valid
float value should be returned for each requested member.
Expand All @@ -266,7 +265,6 @@ def test_zmscore(r: redis.Redis) -> None:
assert all(cached_scores[idx] == score for idx, score in enumerate(scores))


@testtools.run_test_if_redispy_ver("above", "4.2.0")
def test_zmscore_missing_members(r: redis.Redis) -> None:
"""When none of the requested sorted-set members are in the cache, a value
of `None` should be returned once for each requested member."""
Expand All @@ -282,7 +280,6 @@ def test_zmscore_missing_members(r: redis.Redis) -> None:
assert all(score is None for score in cached_scores)


@testtools.run_test_if_redispy_ver("above", "4.2.0")
def test_zmscore_mixed_membership(r: redis.Redis) -> None:
"""When only some requested sorted-set members are in the cache, a
valid float value should be returned for each present member and `None` for
Expand Down
10 changes: 0 additions & 10 deletions test/test_mixins/test_string_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,6 @@ def test_set_conflicting_expire_options(r):
r.set('foo', 'bar', ex=1, px=1)


@testtools.run_test_if_redispy_ver('below', '3.5')
def test_set_conflicting_expire_options_w_keepttl(r):
with pytest.raises(ResponseError):
r.set('foo', 'bar', ex=1, keepttl=True)
with pytest.raises(ResponseError):
r.set('foo', 'bar', px=1, keepttl=True)
with pytest.raises(ResponseError):
r.set('foo', 'bar', ex=1, px=1, keepttl=True)


def test_set_raises_wrong_ex(r):
with pytest.raises(ResponseError):
r.set('foo', 'bar', ex=-100)
Expand Down
2 changes: 0 additions & 2 deletions test/test_zadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def test_zadd_with_nx(r, param, return_value, state, ch):
assert r.zrange('foo', 0, -1, withscores=True) == state


@testtools.run_test_if_redispy_ver('above', '4.2.0')
@pytest.mark.parametrize(
'param,return_value,state',
[
Expand All @@ -84,7 +83,6 @@ def test_zadd_with_gt_and_ch(r, param, return_value, state):
assert r.zrange('foo', 0, -1, withscores=True) == state


@testtools.run_test_if_redispy_ver('above', '4.2.0')
@pytest.mark.parametrize(
'param,return_value,state',
[
Expand Down

0 comments on commit 6b376f4

Please sign in to comment.