summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2017-03-14 11:38:49 -0700
committerDana Powers <dana.powers@gmail.com>2017-03-14 13:30:35 -0700
commita00f9ead161e8b05ac953b460950e42fa0e0b7d6 (patch)
treedccf6020c9f39ca1e7c4ee217a7594dd21e22dfc
parentfea10d9c169214af82303744069bdd6c66c4a2ef (diff)
downloadkafka-python-a00f9ead161e8b05ac953b460950e42fa0e0b7d6.tar.gz
Alter test skips: python-lz4 works on python26, but not pypy
-rw-r--r--test/test_buffer.py4
-rw-r--r--test/test_codec.py13
-rw-r--r--test/test_producer.py4
3 files changed, 14 insertions, 7 deletions
diff --git a/test/test_buffer.py b/test/test_buffer.py
index c8e283d..db6cbb3 100644
--- a/test/test_buffer.py
+++ b/test/test_buffer.py
@@ -2,6 +2,7 @@
from __future__ import absolute_import
import io
+import platform
import pytest
@@ -34,7 +35,8 @@ def test_buffer_close():
@pytest.mark.parametrize('compression', [
'gzip',
'snappy',
- pytest.mark.skipif("sys.version_info < (2,7)")('lz4'), # lz4tools does not work on py26
+ pytest.mark.skipif(platform.python_implementation() == 'PyPy',
+ reason='python-lz4 crashes on older versions of pypy')('lz4'),
])
def test_compressed_buffer_close(compression):
records = MessageSetBuffer(io.BytesIO(), 100000, compression_type=compression)
diff --git a/test/test_codec.py b/test/test_codec.py
index 906b53c..d31fc86 100644
--- a/test/test_codec.py
+++ b/test/test_codec.py
@@ -1,3 +1,6 @@
+from __future__ import absolute_import
+
+import platform
import struct
import pytest
@@ -80,7 +83,8 @@ def test_snappy_encode_xerial():
assert compressed == to_ensure
-@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
+@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
+ reason="python-lz4 crashes on old versions of pypy")
def test_lz4():
for i in xrange(1000):
b1 = random_string(100).encode('utf-8')
@@ -89,7 +93,8 @@ def test_lz4():
assert b1 == b2
-@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
+@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
+ reason="python-lz4 crashes on old versions of pypy")
def test_lz4_old():
for i in xrange(1000):
b1 = random_string(100).encode('utf-8')
@@ -98,8 +103,8 @@ def test_lz4_old():
assert b1 == b2
-@pytest.mark.xfail(reason="lz4tools library doesnt support incremental decompression")
-@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
+@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
+ reason="python-lz4 crashes on old versions of pypy")
def test_lz4_incremental():
for i in xrange(1000):
# lz4 max single block size is 4MB
diff --git a/test/test_producer.py b/test/test_producer.py
index 136d85f..54b9db2 100644
--- a/test/test_producer.py
+++ b/test/test_producer.py
@@ -31,8 +31,8 @@ def test_end_to_end(kafka_broker, compression):
# LZ4 requires 0.8.2
if version() < (0, 8, 2):
return
- # LZ4 python libs don't work on python2.6
- elif sys.version_info < (2, 7):
+ # python-lz4 crashes on older versions of pypy
+ elif platform.python_implementation() == 'PyPy':
return
connect_str = 'localhost:' + str(kafka_broker.port)