@@ -1071,7 +1071,17 @@ def test_read_xlrd_book(self, ext, frame):
1071
1071
tm .assert_frame_equal (df , result )
1072
1072
1073
1073
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 :
1075
1085
1076
1086
@pytest .fixture (autouse = True )
1077
1087
def set_engine_and_path (self , request , engine , ext ):
@@ -1099,20 +1109,6 @@ class and any subclasses, on account of the `autouse=True`
1099
1109
yield
1100
1110
set_option (option_name , prev_engine ) # Roll back option change
1101
1111
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
-
1116
1112
def test_excel_sheet_size (self , engine , ext ):
1117
1113
1118
1114
# GH 26080
@@ -1131,7 +1127,7 @@ def test_excel_sheet_size(self, engine, ext):
1131
1127
with pytest .raises (ValueError , match = msg ):
1132
1128
col_df .to_excel (self .path )
1133
1129
1134
- def test_excel_sheet_by_name_raise (self , engine , ext ):
1130
+ def test_excel_sheet_by_name_raise (self ):
1135
1131
import xlrd
1136
1132
1137
1133
gt = DataFrame (np .random .randn (10 , 2 ))
0 commit comments