@@ -33,28 +33,6 @@ def path(ext):
33
33
yield file_path
34
34
35
35
36
- @pytest .fixture (autouse = True )
37
- def set_engine (engine , ext ):
38
- """Fixture to set engine for use in each test case.
39
-
40
- Rather than requiring `engine=...` to be provided explicitly as an
41
- argument in each test, this fixture sets a global option to dictate
42
- which engine should be used to write Excel files. After executing
43
- the test it rolls back said change to the global option.
44
-
45
- Notes
46
- -----
47
- This fixture will run as part of each test method defined in the
48
- class and any subclasses, on account of the `autouse=True`
49
- argument
50
- """
51
- option_name = "io.excel.{ext}.writer" .format (ext = ext .strip ("." ))
52
- prev_engine = get_option (option_name )
53
- set_option (option_name , engine )
54
- yield
55
- set_option (option_name , prev_engine ) # Roll back option change
56
-
57
-
58
36
@td .skip_if_no ("xlrd" )
59
37
@pytest .mark .parametrize ("ext" , [".xls" , ".xlsx" , ".xlsm" ])
60
38
class TestRoundTrip :
@@ -274,9 +252,30 @@ def test_read_excel_parse_dates(self, ext):
274
252
pytest .param ("xlsxwriter" , ".xlsx" , marks = td .skip_if_no ("xlsxwriter" )),
275
253
],
276
254
)
277
- @pytest .mark .usefixtures ("set_engine" )
255
+
256
+ # @pytest.mark.usefixtures("set_engine")
278
257
class TestExcelWriter :
279
258
# Base class for test cases to run with different Excel writers.
259
+ @pytest .fixture (autouse = True )
260
+ def set_engine (self , engine , ext ):
261
+ """Fixture to set engine for use in each test case.
262
+
263
+ Rather than requiring `engine=...` to be provided explicitly as an
264
+ argument in each test, this fixture sets a global option to dictate
265
+ which engine should be used to write Excel files. After executing
266
+ the test it rolls back said change to the global option.
267
+
268
+ Notes
269
+ -----
270
+ This fixture will run as part of each test method defined in the
271
+ class and any subclasses, on account of the `autouse=True`
272
+ argument
273
+ """
274
+ option_name = "io.excel.{ext}.writer" .format (ext = ext .strip ("." ))
275
+ prev_engine = get_option (option_name )
276
+ set_option (option_name , engine )
277
+ yield
278
+ set_option (option_name , prev_engine ) # Roll back option change
280
279
281
280
def test_excel_sheet_size (self , path ):
282
281
0 commit comments