Skip to content

Commit 9309eba

Browse files
jorisvandenbosschejreback
authored andcommitted
TST: fix excel tests when openpyxl is not installed
Some tests fail when you don't have openpyxl installed, so explicitly skipping those (they need it for certain exts because they write a frame in the test) Author: Joris Van den Bossche <[email protected]> Closes #15209 from jorisvandenbossche/openpyxl-noimport and squashes the following commits: f1cbe8f [Joris Van den Bossche] TST: fix excel tests when openpyxl is not installed
1 parent 699d5e5 commit 9309eba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/io/tests/test_excel.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ def test_read_excel_blank_with_header(self):
449449
# GH 12292 : error when read one empty column from excel file
450450
def test_read_one_empty_col_no_header(self):
451451
_skip_if_no_xlwt()
452+
_skip_if_no_openpyxl()
453+
452454
df = pd.DataFrame(
453455
[["", 1, 100],
454456
["", 2, 200],
@@ -506,6 +508,8 @@ def test_read_one_empty_col_with_header(self):
506508

507509
def test_set_column_names_in_parameter(self):
508510
_skip_if_no_xlwt()
511+
_skip_if_no_openpyxl()
512+
509513
# GH 12870 : pass down column names associated with
510514
# keyword argument names
511515
refdf = pd.DataFrame([[1, 'foo'], [2, 'bar'],
@@ -1798,7 +1802,8 @@ def test_bytes_io(self):
17981802

17991803
bio = BytesIO()
18001804
df = DataFrame(np.random.randn(10, 2))
1801-
writer = ExcelWriter(bio)
1805+
# pass engine explicitly as there is no file path to infer from
1806+
writer = ExcelWriter(bio, engine=self.engine_name)
18021807
df.to_excel(writer)
18031808
writer.save()
18041809
bio.seek(0)

0 commit comments

Comments
 (0)