mirror of https://github.com/celery/kombu.git
Removed Jython bz2 import fallback (#938)
This commit is contained in:
parent
110dc10cbc
commit
bb6d16c28d
|
@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from kombu.utils.encoding import ensure_bytes
|
||||
|
||||
import bz2
|
||||
import zlib
|
||||
|
||||
_aliases = {}
|
||||
|
@ -70,11 +71,7 @@ def decompress(body, content_type):
|
|||
register(zlib.compress,
|
||||
zlib.decompress,
|
||||
'application/x-gzip', aliases=['gzip', 'zlib'])
|
||||
try:
|
||||
import bz2
|
||||
except ImportError:
|
||||
pass # Jython?
|
||||
else:
|
||||
register(bz2.compress,
|
||||
bz2.decompress,
|
||||
'application/x-bz2', aliases=['bzip2', 'bzip'])
|
||||
|
||||
register(bz2.compress,
|
||||
bz2.decompress,
|
||||
'application/x-bz2', aliases=['bzip2', 'bzip'])
|
||||
|
|
|
@ -10,7 +10,7 @@ all_files = 1
|
|||
[flake8]
|
||||
# classes can be lowercase, arguments and variables can be uppercase
|
||||
# whenever it makes the code more readable.
|
||||
ignore = N806, N802, N801, N803
|
||||
ignore = W504, N806, N802, N801, N803
|
||||
|
||||
[pep257]
|
||||
ignore = D102,D104,D203,D105,D213
|
||||
|
|
|
@ -1,28 +1,13 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
from case import mock, skip
|
||||
|
||||
from kombu import compression
|
||||
|
||||
|
||||
class test_compression:
|
||||
|
||||
@mock.mask_modules('bz2')
|
||||
def test_no_bz2(self):
|
||||
c = sys.modules.pop('kombu.compression')
|
||||
try:
|
||||
import kombu.compression
|
||||
assert not hasattr(kombu.compression, 'bz2')
|
||||
finally:
|
||||
if c is not None:
|
||||
sys.modules['kombu.compression'] = c
|
||||
|
||||
def test_encoders__gzip(self):
|
||||
assert 'application/x-gzip' in compression.encoders()
|
||||
|
||||
@skip.unless_module('bz2')
|
||||
def test_encoders__bz2(self):
|
||||
assert 'application/x-bz2' in compression.encoders()
|
||||
|
||||
|
@ -33,7 +18,6 @@ class test_compression:
|
|||
d = compression.decompress(c, ctype)
|
||||
assert d == text
|
||||
|
||||
@skip.unless_module('bz2')
|
||||
def test_compress__decompress__bzip2(self):
|
||||
text = b'The Brown Quick Fox Over The Lazy Dog Jumps'
|
||||
c, ctype = compression.compress(text, 'bzip2')
|
||||
|
|
Loading…
Reference in New Issue