From 00af0de01abfbf07ad42ce6b41b5c3b164b477ae Mon Sep 17 00:00:00 2001 From: John McNamara Date: Thu, 19 Dec 2013 00:01:33 +0000 Subject: [PATCH] TST: Cleanup temp files in Excel test. Issue #5735 --- pandas/io/tests/test_excel.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index eeeb914a3754e..edcb80ae74f6f 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -1070,12 +1070,15 @@ def test_ExcelWriter_dispatch(self): except ImportError: _skip_if_no_openpyxl() writer_klass = _OpenpyxlWriter - writer = ExcelWriter('apple.xlsx') - tm.assert_isinstance(writer, writer_klass) + + with ensure_clean('.xlsx') as path: + writer = ExcelWriter(path) + tm.assert_isinstance(writer, writer_klass) _skip_if_no_xlwt() - writer = ExcelWriter('apple.xls') - tm.assert_isinstance(writer, _XlwtWriter) + with ensure_clean('.xls') as path: + writer = ExcelWriter(path) + tm.assert_isinstance(writer, _XlwtWriter) def test_register_writer(self): # some awkward mocking to test out dispatch and such actually works