Skip to content

Commit 3a6fd0d

Browse files
committed
try to fix import lzma
1 parent 70beb60 commit 3a6fd0d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/tests/io/parser/compression.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515
import gzip
1616
import bz2
17-
lzma = compat.import_lzma()
17+
try:
18+
lzma = compat.import_lzma()
19+
except ImportError:
20+
lzma = None
1821

1922

2023
class CompressionTests(object):
@@ -71,7 +74,7 @@ def test_zip(self):
7174
@pytest.mark.parametrize('compress_type, compress_method, ext', [
7275
('gzip', gzip.GzipFile, 'gz'),
7376
('bz2', bz2.BZ2File, 'bz2'),
74-
pytest.param('xz', lzma.LZMAFile, 'xz',
77+
pytest.param('xz', getattr(lzma, 'LZMAFile', None), 'xz',
7578
marks=td.skip_if_no_lzma)
7679
])
7780
def test_other_compression(self, compress_type, compress_method, ext):

0 commit comments

Comments
 (0)