From b99501ef4a04aabbf6590956044cc79f9249a970 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Sun, 18 Feb 2024 16:18:01 +0100 Subject: [PATCH 1/2] CI: Run excel tests on single cpu for windows --- pandas/tests/io/excel/test_odf.py | 5 +++++ pandas/tests/io/excel/test_odswriter.py | 5 +++++ pandas/tests/io/excel/test_openpyxl.py | 5 +++++ pandas/tests/io/excel/test_readers.py | 4 ++++ pandas/tests/io/excel/test_style.py | 4 ++++ pandas/tests/io/excel/test_writers.py | 4 ++++ pandas/tests/io/excel/test_xlrd.py | 5 +++++ pandas/tests/io/excel/test_xlsxwriter.py | 5 +++++ 8 files changed, 37 insertions(+) diff --git a/pandas/tests/io/excel/test_odf.py b/pandas/tests/io/excel/test_odf.py index f01827fa4ca2f..37a8fd0976502 100644 --- a/pandas/tests/io/excel/test_odf.py +++ b/pandas/tests/io/excel/test_odf.py @@ -3,11 +3,16 @@ import numpy as np import pytest +from pandas.compat import is_platform_windows + import pandas as pd import pandas._testing as tm pytest.importorskip("odf") +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + @pytest.fixture(autouse=True) def cd_and_set_engine(monkeypatch, datapath): diff --git a/pandas/tests/io/excel/test_odswriter.py b/pandas/tests/io/excel/test_odswriter.py index 271353a173d2a..f24399986a529 100644 --- a/pandas/tests/io/excel/test_odswriter.py +++ b/pandas/tests/io/excel/test_odswriter.py @@ -6,6 +6,8 @@ import pytest +from pandas.compat import is_platform_windows + import pandas as pd import pandas._testing as tm @@ -13,6 +15,9 @@ odf = pytest.importorskip("odf") +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + @pytest.fixture def ext(): diff --git a/pandas/tests/io/excel/test_openpyxl.py b/pandas/tests/io/excel/test_openpyxl.py index c20c6daf92931..ff6e3e0a59155 100644 --- a/pandas/tests/io/excel/test_openpyxl.py +++ b/pandas/tests/io/excel/test_openpyxl.py @@ -5,6 +5,8 @@ import numpy as np import pytest +from pandas.compat import is_platform_windows + import pandas as pd from pandas import DataFrame import pandas._testing as tm @@ -17,6 +19,9 @@ openpyxl = pytest.importorskip("openpyxl") +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + @pytest.fixture def ext(): diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index e4a8791396ee2..cafad66155e1b 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -18,6 +18,7 @@ from pandas._config import using_pyarrow_string_dtype +from pandas.compat import is_platform_windows import pandas.util._test_decorators as td import pandas as pd @@ -34,6 +35,9 @@ StringArray, ) +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + read_ext_params = [".xls", ".xlsx", ".xlsm", ".xlsb", ".ods"] engine_params = [ # Add any engines to test here diff --git a/pandas/tests/io/excel/test_style.py b/pandas/tests/io/excel/test_style.py index 58b297e4520bb..a48a8593c252a 100644 --- a/pandas/tests/io/excel/test_style.py +++ b/pandas/tests/io/excel/test_style.py @@ -4,6 +4,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_windows import pandas.util._test_decorators as td from pandas import ( @@ -20,6 +21,9 @@ # could compute styles and render to excel without jinja2, since there is no # 'template' file, but this needs the import error to delayed until render time. +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + def assert_equal_cell_styles(cell1, cell2): # TODO: should find a better way to check equality diff --git a/pandas/tests/io/excel/test_writers.py b/pandas/tests/io/excel/test_writers.py index 3352164b2f980..9202d19a2f2f8 100644 --- a/pandas/tests/io/excel/test_writers.py +++ b/pandas/tests/io/excel/test_writers.py @@ -11,6 +11,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_windows from pandas.compat._constants import PY310 from pandas.compat._optional import import_optional_dependency import pandas.util._test_decorators as td @@ -34,6 +35,9 @@ ) from pandas.io.excel._util import _writers +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + def get_exp_unit(path: str) -> str: return "ns" diff --git a/pandas/tests/io/excel/test_xlrd.py b/pandas/tests/io/excel/test_xlrd.py index c49cbaf7fb26c..2feb75c3957da 100644 --- a/pandas/tests/io/excel/test_xlrd.py +++ b/pandas/tests/io/excel/test_xlrd.py @@ -3,6 +3,8 @@ import numpy as np import pytest +from pandas.compat import is_platform_windows + import pandas as pd import pandas._testing as tm @@ -11,6 +13,9 @@ xlrd = pytest.importorskip("xlrd") +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + @pytest.fixture def read_ext_xlrd(): diff --git a/pandas/tests/io/excel/test_xlsxwriter.py b/pandas/tests/io/excel/test_xlsxwriter.py index 94f6bdfaf069c..aa7d37fa50d4e 100644 --- a/pandas/tests/io/excel/test_xlsxwriter.py +++ b/pandas/tests/io/excel/test_xlsxwriter.py @@ -2,6 +2,8 @@ import pytest +from pandas.compat import is_platform_windows + from pandas import DataFrame import pandas._testing as tm @@ -9,6 +11,9 @@ xlsxwriter = pytest.importorskip("xlsxwriter") +if is_platform_windows: + pytestmark = pytest.mark.single_cpu + @pytest.fixture def ext(): From 4af1f63e2e8d55f3b9f1d875e48632af494b4ff1 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Sun, 18 Feb 2024 21:06:52 +0100 Subject: [PATCH 2/2] Update --- pandas/tests/io/excel/test_odf.py | 2 +- pandas/tests/io/excel/test_odswriter.py | 2 +- pandas/tests/io/excel/test_openpyxl.py | 2 +- pandas/tests/io/excel/test_readers.py | 2 +- pandas/tests/io/excel/test_style.py | 2 +- pandas/tests/io/excel/test_writers.py | 2 +- pandas/tests/io/excel/test_xlrd.py | 2 +- pandas/tests/io/excel/test_xlsxwriter.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/tests/io/excel/test_odf.py b/pandas/tests/io/excel/test_odf.py index 37a8fd0976502..b5bb9b27258d8 100644 --- a/pandas/tests/io/excel/test_odf.py +++ b/pandas/tests/io/excel/test_odf.py @@ -10,7 +10,7 @@ pytest.importorskip("odf") -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_odswriter.py b/pandas/tests/io/excel/test_odswriter.py index f24399986a529..1c728ad801bc1 100644 --- a/pandas/tests/io/excel/test_odswriter.py +++ b/pandas/tests/io/excel/test_odswriter.py @@ -15,7 +15,7 @@ odf = pytest.importorskip("odf") -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_openpyxl.py b/pandas/tests/io/excel/test_openpyxl.py index ff6e3e0a59155..952026b2a50d3 100644 --- a/pandas/tests/io/excel/test_openpyxl.py +++ b/pandas/tests/io/excel/test_openpyxl.py @@ -19,7 +19,7 @@ openpyxl = pytest.importorskip("openpyxl") -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index cafad66155e1b..2cf17913ba6e4 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -35,7 +35,7 @@ StringArray, ) -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu read_ext_params = [".xls", ".xlsx", ".xlsm", ".xlsb", ".ods"] diff --git a/pandas/tests/io/excel/test_style.py b/pandas/tests/io/excel/test_style.py index a48a8593c252a..e801d1c647ed1 100644 --- a/pandas/tests/io/excel/test_style.py +++ b/pandas/tests/io/excel/test_style.py @@ -21,7 +21,7 @@ # could compute styles and render to excel without jinja2, since there is no # 'template' file, but this needs the import error to delayed until render time. -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_writers.py b/pandas/tests/io/excel/test_writers.py index 9202d19a2f2f8..7d958d2d35920 100644 --- a/pandas/tests/io/excel/test_writers.py +++ b/pandas/tests/io/excel/test_writers.py @@ -35,7 +35,7 @@ ) from pandas.io.excel._util import _writers -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_xlrd.py b/pandas/tests/io/excel/test_xlrd.py index 2feb75c3957da..edabbad93acbc 100644 --- a/pandas/tests/io/excel/test_xlrd.py +++ b/pandas/tests/io/excel/test_xlrd.py @@ -13,7 +13,7 @@ xlrd = pytest.importorskip("xlrd") -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu diff --git a/pandas/tests/io/excel/test_xlsxwriter.py b/pandas/tests/io/excel/test_xlsxwriter.py index aa7d37fa50d4e..529367761fc02 100644 --- a/pandas/tests/io/excel/test_xlsxwriter.py +++ b/pandas/tests/io/excel/test_xlsxwriter.py @@ -11,7 +11,7 @@ xlsxwriter = pytest.importorskip("xlsxwriter") -if is_platform_windows: +if is_platform_windows(): pytestmark = pytest.mark.single_cpu