summaryrefslogtreecommitdiff
path: root/test/test_codec.py
diff options
context:
space:
mode:
authorMark Roberts <wizzat@gmail.com>2014-04-08 11:02:57 -0700
committerMark Roberts <wizzat@gmail.com>2014-04-08 11:02:57 -0700
commitd7c5bbf7d4c59d9fe58e96c53340be17392cfa02 (patch)
tree74bdd7fa474c6c555cf0eeb332722d7fec06c093 /test/test_codec.py
parentf0def436c6c9499aa384d8a3fe5319e0c8b9d7da (diff)
downloadkafka-python-d7c5bbf7d4c59d9fe58e96c53340be17392cfa02.tar.gz
Reinstate test_integrate, make test_protocol more explicit, create testutil
Diffstat (limited to 'test/test_codec.py')
-rw-r--r--test/test_codec.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/test/test_codec.py b/test/test_codec.py
index 8872fe7..7fedb71 100644
--- a/test/test_codec.py
+++ b/test/test_codec.py
@@ -20,27 +20,20 @@ from kafka.codec import (
from kafka.protocol import (
create_gzip_message, create_message, create_snappy_message, KafkaProtocol
)
-
-ITERATIONS = 1000
-STRLEN = 100
-
-
-def random_string():
- return os.urandom(random.randint(1, STRLEN))
-
+from .testutil import *
class TestCodec(unittest.TestCase):
@unittest.skipUnless(has_gzip(), "Gzip not available")
def test_gzip(self):
- for i in xrange(ITERATIONS):
- s1 = random_string()
+ for i in xrange(1000):
+ s1 = random_string(100)
s2 = gzip_decode(gzip_encode(s1))
self.assertEquals(s1, s2)
@unittest.skipUnless(has_snappy(), "Snappy not available")
def test_snappy(self):
- for i in xrange(ITERATIONS):
- s1 = random_string()
+ for i in xrange(1000):
+ s1 = random_string(100)
s2 = snappy_decode(snappy_encode(s1))
self.assertEquals(s1, s2)