From abbb6d52c9c724fd64a98b41a7002a6f8713bbfe Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 3 Dec 2019 11:52:54 -0800 Subject: [PATCH 1/3] CI: troubleshoot openpyxl more --- pandas/tests/io/excel/test_openpyxl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/excel/test_openpyxl.py b/pandas/tests/io/excel/test_openpyxl.py index f00329e9c7f81..97d4548430413 100644 --- a/pandas/tests/io/excel/test_openpyxl.py +++ b/pandas/tests/io/excel/test_openpyxl.py @@ -1,8 +1,11 @@ +from distutils.version import LooseVersion import os import numpy as np import pytest +from pandas.compat import PY37 + import pandas as pd from pandas import DataFrame import pandas.util.testing as tm @@ -13,6 +16,8 @@ pytestmark = pytest.mark.parametrize("ext", [".xlsx"]) +openpyxl_gt301 = LooseVersion(openpyxl.__version__) > LooseVersion("3.0.1") + def test_to_excel_styleconverter(ext): from openpyxl import styles @@ -81,6 +86,7 @@ def test_write_cells_merge_styled(ext): assert xcell_a2.font == openpyxl_sty_merged +@pytest.mark.xfail(openpyxl_gt301 and PY37, reason="broken change in openpyxl") @pytest.mark.parametrize( "mode,expected", [("w", ["baz"]), ("a", ["foo", "bar", "baz"])] ) @@ -107,7 +113,7 @@ def test_write_append_mode(ext, mode, expected): assert wb2.worksheets[index]["A1"].value == cell_value -@pytest.mark.xfail(openpyxl.__version__ > "3.0.1", reason="broken change in openpyxl") +@pytest.mark.xfail(openpyxl_gt301 and PY37, reason="broken change in openpyxl") def test_to_excel_with_openpyxl_engine(ext, tmpdir): # GH 29854 # TODO: Fix this once newer version of openpyxl fixes the bug From 4f02f0e2acf1db3681ea0dc8c852c6b956544b7f Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 3 Dec 2019 12:53:26 -0800 Subject: [PATCH 2/3] xfail only for mac? --- pandas/tests/io/excel/test_openpyxl.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/excel/test_openpyxl.py b/pandas/tests/io/excel/test_openpyxl.py index 97d4548430413..90e795bd5c52f 100644 --- a/pandas/tests/io/excel/test_openpyxl.py +++ b/pandas/tests/io/excel/test_openpyxl.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from pandas.compat import PY37 +from pandas.compat import PY37, is_platform_mac import pandas as pd from pandas import DataFrame @@ -86,7 +86,9 @@ def test_write_cells_merge_styled(ext): assert xcell_a2.font == openpyxl_sty_merged -@pytest.mark.xfail(openpyxl_gt301 and PY37, reason="broken change in openpyxl") +@pytest.mark.xfail( + openpyxl_gt301 and PY37 and is_platform_mac(), reason="broken change in openpyxl" +) @pytest.mark.parametrize( "mode,expected", [("w", ["baz"]), ("a", ["foo", "bar", "baz"])] ) @@ -113,7 +115,9 @@ def test_write_append_mode(ext, mode, expected): assert wb2.worksheets[index]["A1"].value == cell_value -@pytest.mark.xfail(openpyxl_gt301 and PY37, reason="broken change in openpyxl") +@pytest.mark.xfail( + openpyxl_gt301 and PY37 and is_platform_mac(), reason="broken change in openpyxl" +) def test_to_excel_with_openpyxl_engine(ext, tmpdir): # GH 29854 # TODO: Fix this once newer version of openpyxl fixes the bug From 917dd75a5b295054429724509052aac4347b1ef8 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 3 Dec 2019 13:51:17 -0800 Subject: [PATCH 3/3] pin openpyxl for travis build --- ci/deps/travis-36-cov.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/deps/travis-36-cov.yaml b/ci/deps/travis-36-cov.yaml index ddc1ea41a08a3..04ff06a99a1f4 100644 --- a/ci/deps/travis-36-cov.yaml +++ b/ci/deps/travis-36-cov.yaml @@ -27,7 +27,8 @@ dependencies: - numexpr - numpy=1.15.* - odfpy - - openpyxl + - openpyxl<=3.0.1 + # https://github.com/pandas-dev/pandas/pull/30009 openpyxl 3.0.2 broke - pandas-gbq # https://github.com/pydata/pandas-gbq/issues/271 - google-cloud-bigquery<=1.11