Skip to content

Commit 1920cf0

Browse files
authored
Merge pull request apache#999 from datastax/replace-lz4-test
PYTHON-1042: replacement for lz4 test
2 parents 85466dd + 039eb29 commit 1920cf0

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
3.17.0
2+
======
3+
NOT RELEASED
4+
5+
Other
6+
-----
7+
* Fail faster on incorrect lz4 import (PYTHON-1042)
8+
9+
110
3.16.0
211
======
312
November 12, 2018

cassandra/connection.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@
6868
except ImportError:
6969
lz4_block = lz4
7070

71+
try:
72+
lz4_block.compress
73+
lz4_block.decompress
74+
except AttributeError:
75+
raise ImportError(
76+
'lz4 not imported correctly. Imported object should have '
77+
'.compress and and .decompress attributes but does not. '
78+
'Please file a bug report on JIRA. (Imported object was '
79+
'{lz4_block})'.format(lz4_block=repr(lz4_block))
80+
)
81+
7182
# Cassandra writes the uncompressed message length in big endian order,
7283
# but the lz4 lib requires little endian order, so we wrap these
7384
# functions to handle that

tests/unit/test_connection.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,6 @@ def send_msg(msg, req_id, msg_callback):
411411
[call(connection)] * get_holders.call_count)
412412

413413

414-
class LZ4Tests(unittest.TestCase):
415-
def test_lz4_is_correctly_imported(self):
416-
try:
417-
import lz4
418-
except ImportError:
419-
return
420-
from lz4 import block as lz4_block
421-
422414
class TimerTest(unittest.TestCase):
423415

424416
def test_timer_collision(self):

0 commit comments

Comments
 (0)