diff options
-rw-r--r-- | tests/conftest.py | 5 | ||||
-rw-r--r-- | tests/test_commands.py | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index d7b2b14..006697f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -37,6 +37,11 @@ def skip_if_server_version_lt(min_version): return pytest.mark.skipif(check, reason="") +def skip_if_server_version_gte(min_version): + check = StrictVersion(get_version()) >= StrictVersion(min_version) + return pytest.mark.skipif(check, reason="") + + @pytest.fixture() def r(request, **kwargs): return _get_client(redis.Redis, request, **kwargs) diff --git a/tests/test_commands.py b/tests/test_commands.py index 8b64c8a..41c24dc 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -10,7 +10,7 @@ from redis._compat import (unichr, u, b, ascii_letters, iteritems, iterkeys, from redis.client import parse_info from redis import exceptions -from .conftest import skip_if_server_version_lt +from .conftest import skip_if_server_version_lt, skip_if_server_version_gte @pytest.fixture() @@ -1459,11 +1459,16 @@ class TestRedisCommands(object): [(2.19093829393386841, 41.43379028184083523), (2.18737632036209106, 41.40634178640635099)] - @skip_if_server_version_lt('3.2.0') + @skip_if_server_version_lt('4.0.0') def test_geopos_no_value(self, r): assert r.geopos('barcelona', 'place1', 'place2') == [None, None] @skip_if_server_version_lt('3.2.0') + @skip_if_server_version_gte('4.0.0') + def test_old_geopos_no_value(self, r): + assert r.geopos('barcelona', 'place1', 'place2') == [] + + @skip_if_server_version_lt('3.2.0') def test_georadius(self, r): values = (2.1909389952632, 41.433791470673, 'place1') +\ (2.1873744593677, 41.406342043777, 'place2') |