Skip to content

Commit be17727

Browse files
committed
Removed WriterBase
1 parent 7fc3f76 commit be17727

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

pandas/tests/io/test_excel.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,17 @@ def test_read_xlrd_book(self, ext, frame):
10711071
tm.assert_frame_equal(df, result)
10721072

10731073

1074-
class _WriterBase:
1074+
@pytest.mark.parametrize("engine,ext", [
1075+
pytest.param('openpyxl', '.xlsx', marks=pytest.mark.skipif(
1076+
not td.safe_import('openpyxl'), reason='No openpyxl')),
1077+
pytest.param('openpyxl', '.xlsm', marks=pytest.mark.skipif(
1078+
not td.safe_import('openpyxl'), reason='No openpyxl')),
1079+
pytest.param('xlwt', '.xls', marks=pytest.mark.skipif(
1080+
not td.safe_import('xlwt'), reason='No xlwt')),
1081+
pytest.param('xlsxwriter', '.xlsx', marks=pytest.mark.skipif(
1082+
not td.safe_import('xlsxwriter'), reason='No xlsxwriter'))
1083+
])
1084+
class TestExcelWriter:
10751085

10761086
@pytest.fixture(autouse=True)
10771087
def set_engine_and_path(self, request, engine, ext):
@@ -1099,20 +1109,6 @@ class and any subclasses, on account of the `autouse=True`
10991109
yield
11001110
set_option(option_name, prev_engine) # Roll back option change
11011111

1102-
1103-
@pytest.mark.parametrize("engine,ext", [
1104-
pytest.param('openpyxl', '.xlsx', marks=pytest.mark.skipif(
1105-
not td.safe_import('openpyxl'), reason='No openpyxl')),
1106-
pytest.param('openpyxl', '.xlsm', marks=pytest.mark.skipif(
1107-
not td.safe_import('openpyxl'), reason='No openpyxl')),
1108-
pytest.param('xlwt', '.xls', marks=pytest.mark.skipif(
1109-
not td.safe_import('xlwt'), reason='No xlwt')),
1110-
pytest.param('xlsxwriter', '.xlsx', marks=pytest.mark.skipif(
1111-
not td.safe_import('xlsxwriter'), reason='No xlsxwriter'))
1112-
])
1113-
class TestExcelWriter(_WriterBase):
1114-
# Base class for test cases to run with different Excel writers.
1115-
11161112
def test_excel_sheet_size(self, engine, ext):
11171113

11181114
# GH 26080
@@ -1131,7 +1127,7 @@ def test_excel_sheet_size(self, engine, ext):
11311127
with pytest.raises(ValueError, match=msg):
11321128
col_df.to_excel(self.path)
11331129

1134-
def test_excel_sheet_by_name_raise(self, engine, ext):
1130+
def test_excel_sheet_by_name_raise(self):
11351131
import xlrd
11361132

11371133
gt = DataFrame(np.random.randn(10, 2))

0 commit comments

Comments
 (0)