Skip to content

Backport PR #45581 on branch 1.4.x (CI: Fix actions-310 testing 3.9 instead of 3.10) #45755

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

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pandas-dev
channels:
- conda-forge
dependencies:
- python=3.9
- python=3.10

# test dependencies
- cython=0.29.24
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/io/test_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import pytest

from pandas.compat import PY310
from pandas.compat._optional import VERSIONS

from pandas import (
Expand Down Expand Up @@ -181,6 +182,7 @@ def test_arrowparquet_options(fsspectest):

@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) fastparquet
@td.skip_if_no("fastparquet")
@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_fastparquet_options(fsspectest):
"""Regression test for writing to a not-yet-existent GCS Parquet file."""
df = DataFrame({"a": [0]})
Expand Down
42 changes: 37 additions & 5 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from pandas._config import get_option

from pandas.compat import PY310
from pandas.compat.pyarrow import (
pa_version_under2p0,
pa_version_under5p0,
Expand Down Expand Up @@ -261,6 +262,7 @@ def test_options_py(df_compat, pa):
check_round_trip(df_compat)


@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_options_fp(df_compat, fp):
# use the set option

Expand Down Expand Up @@ -338,6 +340,7 @@ def test_get_engine_auto_error_message():
get_engine("auto")


@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_cross_engine_pa_fp(df_cross_compat, pa, fp):
# cross-compat with differing reading/writing engines

Expand Down Expand Up @@ -404,7 +407,11 @@ def test_error(self, engine):
msg = "to_parquet only supports IO with DataFrames"
self.check_error_on_write(obj, engine, ValueError, msg)

def test_columns_dtypes(self, engine):
def test_columns_dtypes(self, request, engine):
if PY310 and engine == "fastparquet":
request.node.add_marker(
pytest.mark.xfail(reason="fastparquet failing on 3.10")
)
df = pd.DataFrame({"string": list("abc"), "int": list(range(1, 4))})

# unicode
Expand All @@ -431,27 +438,39 @@ def test_columns_dtypes_invalid(self, engine):
self.check_error_on_write(df, engine, ValueError, msg)

@pytest.mark.parametrize("compression", [None, "gzip", "snappy", "brotli"])
def test_compression(self, engine, compression):
def test_compression(self, engine, compression, request):

if compression == "snappy":
pytest.importorskip("snappy")

elif compression == "brotli":
pytest.importorskip("brotli")

if PY310 and engine == "fastparquet":
request.node.add_marker(
pytest.mark.xfail(reason="fastparquet failing on 3.10")
)
df = pd.DataFrame({"A": [1, 2, 3]})
check_round_trip(df, engine, write_kwargs={"compression": compression})

def test_read_columns(self, engine):
def test_read_columns(self, engine, request):
# GH18154
if PY310 and engine == "fastparquet":
request.node.add_marker(
pytest.mark.xfail(reason="fastparquet failing on 3.10")
)
df = pd.DataFrame({"string": list("abc"), "int": list(range(1, 4))})

expected = pd.DataFrame({"string": list("abc")})
check_round_trip(
df, engine, expected=expected, read_kwargs={"columns": ["string"]}
)

def test_write_index(self, engine):
def test_write_index(self, engine, request):
if PY310 and engine == "fastparquet":
request.node.add_marker(
pytest.mark.xfail(reason="fastparquet failing on 3.10")
)
check_names = engine != "fastparquet"

df = pd.DataFrame({"A": [1, 2, 3]})
Expand Down Expand Up @@ -500,9 +519,13 @@ def test_multiindex_with_columns(self, pa):
df, engine, read_kwargs={"columns": ["A", "B"]}, expected=df[["A", "B"]]
)

def test_write_ignoring_index(self, engine):
def test_write_ignoring_index(self, engine, request):
# ENH 20768
# Ensure index=False omits the index from the written Parquet file.
if PY310 and engine == "fastparquet":
request.node.add_marker(
pytest.mark.xfail(reason="fastparquet failing on 3.10")
)
df = pd.DataFrame({"a": [1, 2, 3], "b": ["q", "r", "s"]})

write_kwargs = {"compression": None, "index": False}
Expand Down Expand Up @@ -958,6 +981,7 @@ def test_read_parquet_manager(self, pa, using_array_manager):


class TestParquetFastParquet(Base):
@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_basic(self, fp, df_full):
df = df_full

Expand All @@ -975,6 +999,7 @@ def test_duplicate_columns(self, fp):
msg = "Cannot create parquet dataset with duplicate column names"
self.check_error_on_write(df, fp, ValueError, msg)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_bool_with_none(self, fp):
df = pd.DataFrame({"a": [True, None, False]})
expected = pd.DataFrame({"a": [1.0, np.nan, 0.0]}, dtype="float16")
Expand All @@ -994,10 +1019,12 @@ def test_unsupported(self, fp):
msg = "Can't infer object conversion type"
self.check_error_on_write(df, fp, ValueError, msg)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_categorical(self, fp):
df = pd.DataFrame({"a": pd.Categorical(list("abc"))})
check_round_trip(df, fp)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_filter_row_groups(self, fp):
d = {"a": list(range(0, 3))}
df = pd.DataFrame(d)
Expand All @@ -1016,6 +1043,7 @@ def test_s3_roundtrip(self, df_compat, s3_resource, fp, s3so):
write_kwargs={"compression": None, "storage_options": s3so},
)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_partition_cols_supported(self, fp, df_full):
# GH #23283
partition_cols = ["bool", "int"]
Expand All @@ -1033,6 +1061,7 @@ def test_partition_cols_supported(self, fp, df_full):
actual_partition_cols = fastparquet.ParquetFile(path, False).cats
assert len(actual_partition_cols) == 2

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_partition_cols_string(self, fp, df_full):
# GH #27117
partition_cols = "bool"
Expand All @@ -1050,6 +1079,7 @@ def test_partition_cols_string(self, fp, df_full):
actual_partition_cols = fastparquet.ParquetFile(path, False).cats
assert len(actual_partition_cols) == 1

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_partition_on_supported(self, fp, df_full):
# GH #23283
partition_cols = ["bool", "int"]
Expand Down Expand Up @@ -1085,13 +1115,15 @@ def test_error_on_using_partition_cols_and_partition_on(self, fp, df_full):
partition_cols=partition_cols,
)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_empty_dataframe(self, fp):
# GH #27339
df = pd.DataFrame()
expected = df.copy()
expected.index.name = "index"
check_round_trip(df, fp, expected=expected)

@pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10")
def test_timezone_aware_index(self, fp, timezone_aware_date_list):
idx = 5 * [timezone_aware_date_list]

Expand Down
11 changes: 9 additions & 2 deletions pandas/tests/io/test_user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import pytest

from pandas.compat import PY310
import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -242,7 +243,10 @@ def responder(request):
pd.read_parquet,
"fastparquet",
# TODO(ArrayManager) fastparquet
marks=td.skip_array_manager_not_yet_implemented,
marks=[
td.skip_array_manager_not_yet_implemented,
pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10"),
],
),
(PickleUserAgentResponder, pd.read_pickle, None),
(StataUserAgentResponder, pd.read_stata, None),
Expand Down Expand Up @@ -277,7 +281,10 @@ def test_server_and_default_headers(responder, read_method, parquet_engine):
pd.read_parquet,
"fastparquet",
# TODO(ArrayManager) fastparquet
marks=td.skip_array_manager_not_yet_implemented,
marks=[
td.skip_array_manager_not_yet_implemented,
pytest.mark.xfail(PY310, reason="fastparquet failing on 3.10"),
],
),
(PickleUserAgentResponder, pd.read_pickle, None),
(StataUserAgentResponder, pd.read_stata, None),
Expand Down