Skip to content

Commit ac88929

Browse files
committed
TST: skip tests needing xlrd
1 parent c03f0ca commit ac88929

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/io/tests/test_excel.py

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
def _skip_if_no_xlrd():
4242
try:
4343
import xlrd
44+
ver = tuple(map(int, xlrd.__VERSION__.split(".")[:2]))
45+
if ver < (0, 9):
46+
raise nose.SkipTest('xlrd not installed, skipping')
4447
except ImportError:
4548
raise nose.SkipTest('xlrd not installed, skipping')
4649

@@ -215,6 +218,7 @@ def test_excel_read_buffer(self):
215218
df = xl.parse('Sheet1', index_col=0, parse_dates=True)
216219

217220
def test_xlsx_table(self):
221+
_skip_if_no_xlrd()
218222
_skip_if_no_openpyxl()
219223

220224
pth = os.path.join(self.dirpath, 'test.xlsx')
@@ -294,6 +298,7 @@ def test_excel_roundtrip_xls_mixed(self):
294298

295299
def test_excel_roundtrip_xlsx_mixed(self):
296300
_skip_if_no_openpyxl()
301+
_skip_if_no_xlrd()
297302

298303
self._check_extension_mixed('xlsx')
299304

@@ -314,6 +319,7 @@ def test_excel_roundtrip_xls_tsframe(self):
314319

315320
def test_excel_roundtrip_xlsx_tsframe(self):
316321
_skip_if_no_openpyxl()
322+
_skip_if_no_xlrd()
317323
self._check_extension_tsframe('xlsx')
318324

319325
def _check_extension_tsframe(self, ext):
@@ -555,6 +561,7 @@ def test_to_excel_multiindex(self):
555561
self._check_excel_multiindex('xls')
556562

557563
def test_to_excel_multiindex_xlsx(self):
564+
_skip_if_no_xlrd()
558565
_skip_if_no_openpyxl()
559566
self._check_excel_multiindex('xlsx')
560567

@@ -587,6 +594,7 @@ def test_to_excel_multiindex_dates(self):
587594

588595
def test_to_excel_multiindex_xlsx_dates(self):
589596
_skip_if_no_openpyxl()
597+
_skip_if_no_xlrd()
590598
self._check_excel_multiindex_dates('xlsx')
591599

592600
def _check_excel_multiindex_dates(self, ext):

0 commit comments

Comments
 (0)