summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTaras Voinarovskyi <voyn1991@gmail.com>2018-02-21 23:05:31 +0200
committerGitHub <noreply@github.com>2018-02-21 23:05:31 +0200
commit0c0c7eae13f3b2b8e3ed7c443adef39cb6802a67 (patch)
tree2cb5e5660842baa9dcd08a7f716c3a4461f20de7 /test
parent92635d9bfff5593ba865003dd3010a0feb280140 (diff)
downloadkafka-python-0c0c7eae13f3b2b8e3ed7c443adef39cb6802a67.tar.gz
Use hardware accelerated CRC32C function if available (#1389)
* Use hardware accelerated CRC32C function if available * Add doc notice of optional `crc32c` package
Diffstat (limited to 'test')
-rw-r--r--test/record/test_util.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/record/test_util.py b/test/record/test_util.py
index bfe0fcc..0b2782e 100644
--- a/test/record/test_util.py
+++ b/test/record/test_util.py
@@ -68,9 +68,10 @@ def test_size_of_varint(encoded, decoded):
assert util.size_of_varint(decoded) == len(encoded)
-def test_crc32c():
+@pytest.mark.parametrize("crc32_func", [util.crc32c_c, util.crc32c_py])
+def test_crc32c(crc32_func):
def make_crc(data):
- crc = util.calc_crc32c(data)
+ crc = crc32_func(data)
return struct.pack(">I", crc)
assert make_crc(b"") == b"\x00\x00\x00\x00"
assert make_crc(b"a") == b"\xc1\xd0\x43\x30"