@@ -55,17 +55,16 @@ def test_submodule_namespace(self):
55
55
56
56
57
57
class TestCodec (unittest .TestCase ):
58
+
59
+ @unittest .skipUnless (has_gzip (), "Gzip not available" )
58
60
def test_gzip (self ):
59
- if not has_gzip ():
60
- return
61
61
for i in xrange (ITERATIONS ):
62
62
s1 = random_string ()
63
63
s2 = gzip_decode (gzip_encode (s1 ))
64
64
self .assertEquals (s1 , s2 )
65
65
66
+ @unittest .skipUnless (has_snappy (), "Snappy not available" )
66
67
def test_snappy (self ):
67
- if not has_snappy ():
68
- return
69
68
for i in xrange (ITERATIONS ):
70
69
s1 = random_string ()
71
70
s2 = snappy_decode (snappy_encode (s1 ))
@@ -83,6 +82,7 @@ def test_create_message(self):
83
82
self .assertEqual (msg .key , key )
84
83
self .assertEqual (msg .value , payload )
85
84
85
+ @unittest .skipUnless (has_gzip (), "Snappy not available" )
86
86
def test_create_gzip (self ):
87
87
payloads = ["v1" , "v2" ]
88
88
msg = create_gzip_message (payloads )
@@ -98,6 +98,7 @@ def test_create_gzip(self):
98
98
"\xff \xff \x00 \x00 \x00 \x02 v2" )
99
99
self .assertEqual (decoded , expect )
100
100
101
+ @unittest .skipUnless (has_snappy (), "Snappy not available" )
101
102
def test_create_snappy (self ):
102
103
payloads = ["v1" , "v2" ]
103
104
msg = create_snappy_message (payloads )
@@ -157,6 +158,7 @@ def test_decode_message_set(self):
157
158
self .assertEqual (returned_offset2 , 0 )
158
159
self .assertEqual (decoded_message2 , create_message ("v2" ))
159
160
161
+ @unittest .skipUnless (has_gzip (), "Gzip not available" )
160
162
def test_decode_message_gzip (self ):
161
163
gzip_encoded = ('\xc0 \x11 \xb2 \xf0 \x00 \x01 \xff \xff \xff \xff \x00 \x00 \x00 0'
162
164
'\x1f \x8b \x08 \x00 \xa1 \xc1 \xc5 R\x02 \xff c`\x80 \x03 \x01 '
@@ -173,6 +175,7 @@ def test_decode_message_gzip(self):
173
175
self .assertEqual (returned_offset2 , 0 )
174
176
self .assertEqual (decoded_message2 , create_message ("v2" ))
175
177
178
+ @unittest .skipUnless (has_snappy (), "Snappy not available" )
176
179
def test_decode_message_snappy (self ):
177
180
snappy_encoded = ('\xec \x80 \xa1 \x95 \x00 \x02 \xff \xff \xff \xff \x00 \x00 '
178
181
'\x00 ,8\x00 \x00 \x19 \x01 @\x10 L\x9f [\xc2 \x00 \x00 \xff '
0 commit comments