Skip to content

Commit fd054aa

Browse files
committed
Alter test skips: python-lz4 works on python26, but not pypy
1 parent 9ba21b8 commit fd054aa

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

test/test_buffer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import
33

44
import io
5+
import platform
56

67
import pytest
78

@@ -34,7 +35,8 @@ def test_buffer_close():
3435
@pytest.mark.parametrize('compression', [
3536
'gzip',
3637
'snappy',
37-
pytest.mark.skipif("sys.version_info < (2,7)")('lz4'), # lz4tools does not work on py26
38+
pytest.mark.skipif(platform.python_implementation() == 'PyPy',
39+
reason='python-lz4 crashes on older versions of pypy')('lz4'),
3840
])
3941
def test_compressed_buffer_close(compression):
4042
records = MessageSetBuffer(io.BytesIO(), 100000, compression_type=compression)

test/test_codec.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from __future__ import absolute_import
2+
3+
import platform
14
import struct
25

36
import pytest
@@ -80,7 +83,8 @@ def test_snappy_encode_xerial():
8083
assert compressed == to_ensure
8184

8285

83-
@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
86+
@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
87+
reason="python-lz4 crashes on old versions of pypy")
8488
def test_lz4():
8589
for i in xrange(1000):
8690
b1 = random_string(100).encode('utf-8')
@@ -89,7 +93,8 @@ def test_lz4():
8993
assert b1 == b2
9094

9195

92-
@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
96+
@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
97+
reason="python-lz4 crashes on old versions of pypy")
9398
def test_lz4_old():
9499
for i in xrange(1000):
95100
b1 = random_string(100).encode('utf-8')
@@ -98,8 +103,8 @@ def test_lz4_old():
98103
assert b1 == b2
99104

100105

101-
@pytest.mark.xfail(reason="lz4tools library doesnt support incremental decompression")
102-
@pytest.mark.skipif(not has_lz4(), reason="LZ4 not available")
106+
@pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
107+
reason="python-lz4 crashes on old versions of pypy")
103108
def test_lz4_incremental():
104109
for i in xrange(1000):
105110
# lz4 max single block size is 4MB

test/test_producer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def test_end_to_end(kafka_broker, compression):
3131
# LZ4 requires 0.8.2
3232
if version() < (0, 8, 2):
3333
return
34-
# LZ4 python libs don't work on python2.6
35-
elif sys.version_info < (2, 7):
34+
# python-lz4 crashes on older versions of pypy
35+
elif platform.python_implementation() == 'PyPy':
3636
return
3737

3838
connect_str = 'localhost:' + str(kafka_broker.port)

0 commit comments

Comments
 (0)