Skip to content

Commit f1f225c

Browse files
committed
Skip 64-bit specific tests. (Closes: #899)
Signed-off-by: Chris Lamb <[email protected]>
1 parent c8936f7 commit f1f225c

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

tests/conftest.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
from distutils.version import StrictVersion
66

77

8-
_REDIS_VERSIONS = {}
8+
_REDIS_INFO = {}
99

1010

11-
def get_version(**kwargs):
11+
def get_info(**kwargs):
1212
params = {'host': 'localhost', 'port': 6379, 'db': 9}
1313
params.update(kwargs)
1414
key = '%s:%s' % (params['host'], params['port'])
15-
if key not in _REDIS_VERSIONS:
15+
if key not in _REDIS_INFO:
1616
client = redis.Redis(**params)
17-
_REDIS_VERSIONS[key] = client.info()['redis_version']
17+
_REDIS_INFO[key] = client.info()
1818
client.connection_pool.disconnect()
19-
return _REDIS_VERSIONS[key]
19+
return _REDIS_INFO[key]
2020

2121

2222
def _get_client(cls, request=None, **kwargs):
@@ -33,15 +33,22 @@ def teardown():
3333

3434

3535
def skip_if_server_version_lt(min_version):
36-
check = StrictVersion(get_version()) < StrictVersion(min_version)
36+
redis_version = get_info()['redis_version']
37+
check = StrictVersion(redis_version) < StrictVersion(min_version)
3738
return pytest.mark.skipif(check, reason="")
3839

3940

4041
def skip_if_server_version_gte(min_version):
41-
check = StrictVersion(get_version()) >= StrictVersion(min_version)
42+
redis_version = get_info()['redis_version']
43+
check = StrictVersion(redis_version) >= StrictVersion(min_version)
4244
return pytest.mark.skipif(check, reason="")
4345

4446

47+
def skip_unless_arch_bits(arch_bits):
48+
return pytest.mark.skipif(get_info()['arch_bits'] != arch_bits,
49+
reason="server is not {}-bit".format(arch_bits))
50+
51+
4552
@pytest.fixture()
4653
def r(request, **kwargs):
4754
return _get_client(redis.Redis, request, **kwargs)

tests/test_commands.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from redis.client import parse_info
1212
from redis import exceptions
1313

14-
from .conftest import skip_if_server_version_lt, skip_if_server_version_gte
14+
from .conftest import (skip_if_server_version_lt, skip_if_server_version_gte,
15+
skip_unless_arch_bits)
1516

1617

1718
@pytest.fixture()
@@ -1630,6 +1631,7 @@ def test_geohash(self, r):
16301631
assert r.geohash('barcelona', 'place1', 'place2') ==\
16311632
['sp3e9yg3kd0', 'sp3e9cbc3t0']
16321633

1634+
@skip_unless_arch_bits(64)
16331635
@skip_if_server_version_lt('3.2.0')
16341636
def test_geopos(self, r):
16351637
values = (2.1909389952632, 41.433791470673, 'place1') +\
@@ -1675,6 +1677,7 @@ def test_georadius_units(self, r):
16751677
assert r.georadius('barcelona', 2.191, 41.433, 1, unit='km') ==\
16761678
['place1']
16771679

1680+
@skip_unless_arch_bits(64)
16781681
@skip_if_server_version_lt('3.2.0')
16791682
def test_georadius_with(self, r):
16801683
values = (2.1909389952632, 41.433791470673, 'place1') +\
@@ -1732,6 +1735,7 @@ def test_georadius_store(self, r):
17321735
r.georadius('barcelona', 2.191, 41.433, 1000, store='places_barcelona')
17331736
assert r.zrange('places_barcelona', 0, -1) == [b'place1']
17341737

1738+
@skip_unless_arch_bits(64)
17351739
@skip_if_server_version_lt('3.2.0')
17361740
def test_georadius_store_dist(self, r):
17371741
values = (2.1909389952632, 41.433791470673, 'place1') +\
@@ -1743,6 +1747,7 @@ def test_georadius_store_dist(self, r):
17431747
# instead of save the geo score, the distance is saved.
17441748
assert r.zscore('places_barcelona', 'place1') == 88.05060698409301
17451749

1750+
@skip_unless_arch_bits(64)
17461751
@skip_if_server_version_lt('3.2.0')
17471752
def test_georadiusmember(self, r):
17481753
values = (2.1909389952632, 41.433791470673, 'place1') +\

0 commit comments

Comments
 (0)