From 9e6474da040cb9a64641d5727de8def2b946105e Mon Sep 17 00:00:00 2001 From: Robert de Vries Date: Mon, 29 Jun 2020 23:52:43 +0200 Subject: [PATCH] Suppress FutureWarnings added by this change in unrelated tests --- pandas/tests/io/excel/test_xlrd.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/excel/test_xlrd.py b/pandas/tests/io/excel/test_xlrd.py index 24b630b84d4d2b..c8cb9211b3667f 100644 --- a/pandas/tests/io/excel/test_xlrd.py +++ b/pandas/tests/io/excel/test_xlrd.py @@ -19,6 +19,9 @@ def skip_ods_and_xlsb_files(read_ext): pytest.skip("Not valid for xlrd") +@pytest.mark.filterwarnings( + "ignore:The Excel reader engine will default to:FutureWarning" +) def test_read_xlrd_book(read_ext, frame): df = frame @@ -38,13 +41,14 @@ def test_read_xlrd_book(read_ext, frame): # TODO: test for openpyxl as well +@pytest.mark.filterwarnings( + "ignore:The Excel reader engine will default to:FutureWarning" +) def test_excel_table_sheet_by_index(datapath, read_ext): path = datapath("io", "data", "excel", f"test1{read_ext}") - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - with pd.ExcelFile(path) as excel: - with pytest.raises(xlrd.XLRDError): - pd.read_excel(excel, sheet_name="asdf") + with pd.ExcelFile(path) as excel: + with pytest.raises(xlrd.XLRDError): + pd.read_excel(excel, sheet_name="asdf") # See issue #29375