Skip to content

Commit 417fc30

Browse files
committed
Decoupled xlrd skips and base reading tests
1 parent 620fa19 commit 417fc30

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pandas/tests/io/test_excel.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ def ignore_xlrd_time_clock_warning():
5151
yield
5252

5353

54-
@td.skip_if_no('xlrd')
5554
@pytest.mark.parametrize("ext", ['.xls', '.xlsx', '.xlsm'])
5655
class TestReaders:
57-
# This is based on ExcelWriterBase
5856

59-
@pytest.fixture(autouse=True, params=['xlrd', None])
57+
@pytest.fixture(autouse=True, params=[
58+
# Add any engines to test here
59+
pytest.param('xlrd', marks=pytest.mark.skipif(
60+
not td.safe_import("xlrd"), reason="no xlrd")),
61+
pytest.param(None, marks=pytest.mark.skipif(
62+
not td.safe_import("xlrd"), reason="no xlrd")),
63+
])
6064
def cd_and_set_engine(self, request, datapath, monkeypatch):
6165
"""
6266
Change directory and set engine for read_excel calls.
@@ -74,7 +78,6 @@ def df_ref(self):
7478
parse_dates=True, engine='python')
7579
return df_ref
7680

77-
@td.skip_if_no("xlrd", "1.0.1") # see gh-22682
7881
def test_usecols_int(self, ext, df_ref):
7982
df_ref = df_ref.reindex(columns=["A", "B", "C"])
8083

@@ -96,7 +99,6 @@ def test_usecols_int(self, ext, df_ref):
9699
tm.assert_frame_equal(df1, df_ref, check_names=False)
97100
tm.assert_frame_equal(df2, df_ref, check_names=False)
98101

99-
@td.skip_if_no('xlrd', '1.0.1') # GH-22682
100102
def test_usecols_list(self, ext, df_ref):
101103

102104
df_ref = df_ref.reindex(columns=['B', 'C'])
@@ -109,7 +111,6 @@ def test_usecols_list(self, ext, df_ref):
109111
tm.assert_frame_equal(df1, df_ref, check_names=False)
110112
tm.assert_frame_equal(df2, df_ref, check_names=False)
111113

112-
@td.skip_if_no('xlrd', '1.0.1') # GH-22682
113114
def test_usecols_str(self, ext, df_ref):
114115

115116
df1 = df_ref.reindex(columns=['A', 'B', 'C'])
@@ -264,7 +265,6 @@ def test_excel_passes_na(self, ext):
264265
columns=['Test'])
265266
tm.assert_frame_equal(parsed, expected)
266267

267-
@td.skip_if_no('xlrd', '1.0.1') # GH-22682
268268
@pytest.mark.parametrize('arg', ['sheet', 'sheetname', 'parse_cols'])
269269
def test_unexpected_kwargs_raises(self, ext, arg):
270270
# gh-17964
@@ -275,7 +275,6 @@ def test_unexpected_kwargs_raises(self, ext, arg):
275275
with pytest.raises(TypeError, match=msg):
276276
pd.read_excel(excel, **kwarg)
277277

278-
@td.skip_if_no('xlrd', '1.0.1') # GH-22682
279278
def test_excel_table_sheet_by_index(self, ext, df_ref):
280279

281280
excel = ExcelFile('test1' + ext)
@@ -493,7 +492,6 @@ def test_date_conversion_overflow(self, ext):
493492
result = pd.read_excel('testdateoverflow' + ext)
494493
tm.assert_frame_equal(result, expected)
495494

496-
@td.skip_if_no("xlrd", "1.0.1") # see gh-22682
497495
def test_sheet_name_and_sheetname(self, ext, df_ref):
498496
# gh-10559: Minor improvement: Change "sheet_name" to "sheetname"
499497
# gh-10969: DOC: Consistent var names (sheetname vs sheet_name)

0 commit comments

Comments
 (0)