From f1cbe8f393c413c53560eb7463f7a306bb7895eb Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 24 Jan 2017 14:37:49 +0100 Subject: [PATCH] TST: fix excel tests when openpyxl is not installed --- pandas/io/tests/test_excel.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index a2162320d9d1b..12aecfd50c3a6 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -449,6 +449,8 @@ def test_read_excel_blank_with_header(self): # GH 12292 : error when read one empty column from excel file def test_read_one_empty_col_no_header(self): _skip_if_no_xlwt() + _skip_if_no_openpyxl() + df = pd.DataFrame( [["", 1, 100], ["", 2, 200], @@ -506,6 +508,8 @@ def test_read_one_empty_col_with_header(self): def test_set_column_names_in_parameter(self): _skip_if_no_xlwt() + _skip_if_no_openpyxl() + # GH 12870 : pass down column names associated with # keyword argument names refdf = pd.DataFrame([[1, 'foo'], [2, 'bar'], @@ -1798,7 +1802,8 @@ def test_bytes_io(self): bio = BytesIO() df = DataFrame(np.random.randn(10, 2)) - writer = ExcelWriter(bio) + # pass engine explicitly as there is no file path to infer from + writer = ExcelWriter(bio, engine=self.engine_name) df.to_excel(writer) writer.save() bio.seek(0)