Skip to content

TST: fix excel tests when openpyxl is not installed #15209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pandas/io/tests/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -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)
Expand Down