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