Fix or skip s390x failures

This commit is contained in:
Benjamin A. Beasley 2022-11-25 12:46:48 -05:00
parent a09cd10c3c
commit 39863023ee
2 changed files with 111 additions and 8 deletions

70
49913.patch Normal file
View File

@ -0,0 +1,70 @@
From a7a17abcd9f03651ae07a0aa138668fd49287466 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Fri, 25 Nov 2022 09:06:56 -0500
Subject: [PATCH] TST: Fix some little-endian assumptions
See previous PR#46681.
---
pandas/tests/arrays/floating/test_arithmetic.py | 2 +-
pandas/tests/frame/methods/test_to_records.py | 14 ++++++++++++--
pandas/tests/scalar/timedelta/test_arithmetic.py | 2 +-
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/pandas/tests/arrays/floating/test_arithmetic.py b/pandas/tests/arrays/floating/test_arithmetic.py
index ec7419d6346a8..fdf2b00bdbac1 100644
--- a/pandas/tests/arrays/floating/test_arithmetic.py
+++ b/pandas/tests/arrays/floating/test_arithmetic.py
@@ -162,7 +162,7 @@ def test_error_invalid_values(data, all_arithmetic_operators):
"not all arguments converted during string formatting",
"can't multiply sequence by non-int of type 'float'",
"ufunc 'subtract' cannot use operands with types dtype",
- r"ufunc 'add' cannot use operands with types dtype\('<M8\[ns\]'\)",
+ rf"ufunc 'add' cannot use operands with types dtype\('{tm.ENDIAN}M8\[ns\]'\)",
r"ufunc 'add' cannot use operands with types dtype\('float\d{2}'\)",
"cannot subtract DatetimeArray from ndarray",
]
diff --git a/pandas/tests/frame/methods/test_to_records.py b/pandas/tests/frame/methods/test_to_records.py
index 32cccddc9d515..701063c277226 100644
--- a/pandas/tests/frame/methods/test_to_records.py
+++ b/pandas/tests/frame/methods/test_to_records.py
@@ -96,7 +96,13 @@ def test_to_records_index_name(self):
+ [np.asarray(df.iloc[:, i]) for i in range(3)],
dtype={
"names": ["A", "level_1", "0", "1", "2"],
- "formats": ["O", "O", "<f8", "<f8", "<f8"],
+ "formats": [
+ "O",
+ "O",
+ f"{tm.ENDIAN}f8",
+ f"{tm.ENDIAN}f8",
+ f"{tm.ENDIAN}f8",
+ ],
},
)
tm.assert_numpy_array_equal(result, expected)
@@ -123,7 +129,11 @@ def test_to_records_index_dtype(self):
("2022-01-01", "2022-01-01", "2022-01-01"),
("2022-01-02", "2022-01-02", "2022-01-02"),
],
- dtype=[("1", "<M8[ns]"), ("2", "<M8[ns]"), ("3", "<M8[ns]")],
+ dtype=[
+ ("1", f"{tm.ENDIAN}M8[ns]"),
+ ("2", f"{tm.ENDIAN}M8[ns]"),
+ ("3", f"{tm.ENDIAN}M8[ns]"),
+ ],
)
result = df.to_records(index=False)
diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py
index 1c3868bc85fd5..526b558ecb813 100644
--- a/pandas/tests/scalar/timedelta/test_arithmetic.py
+++ b/pandas/tests/scalar/timedelta/test_arithmetic.py
@@ -435,7 +435,7 @@ def test_td_mul_td64_ndarray_invalid(self):
msg = (
"ufunc '?multiply'? cannot use operands with types "
- r"dtype\('<m8\[ns\]'\) and dtype\('<m8\[ns\]'\)"
+ rf"dtype\('{tm.ENDIAN}m8\[ns\]'\) and dtype\('{tm.ENDIAN}m8\[ns\]'\)"
)
with pytest.raises(TypeError, match=msg):
td * other

View File

@ -74,6 +74,10 @@ URL: https://pandas.pydata.org/
# The GitHub archive contains tests; the PyPI sdist does not.
Source0: https://github.com/pandas-dev/pandas/archive/v%{version}/pandas-%{version}.tar.gz
# Fix some little-endian assumptions in the tests
# https://github.com/pandas-dev/pandas/pull/49913
Patch: https://github.com/pandas-dev/pandas/pull/49913.patch
%global _description %{expand:
pandas is an open source, BSD-licensed library providing
high-performance, easy-to-use data structures and data
@ -481,14 +485,6 @@ m="${m-}${m+ and }not single"
k="${k-}${k+ and }not (TestFloatSubtype and test_subtype_integer_errors)"
%endif
%ifarch s390x
# TODO: Why does this fail?
#
# > os.fsync(self._handle.fileno())
# E OverflowError: Python int too large to convert to C int
k="${k-}${k+ and }not test_flush"
%endif
%ifarch %{arm64}
# TODO: Why does this fail?
# > with pytest.raises(ValueError, match="external reference.*"):
@ -578,6 +574,43 @@ k="${k-}${k+ and }not (TestWeek and test_apply_out_of_range)"
k="${k-}${k+ and }not (TestDateRanges and test_date_range_int64_overflow_stride_endpoint_different_signs)"
%endif
%ifarch s390x
# Note that pandas does not test big-endian support but will happily accept
# patches to improve it:
# https://github.com/pandas-dev/pandas/issues/4737#issuecomment-1090931741
# TODO: Why does this fail?
#
# > os.fsync(self._handle.fileno())
# E OverflowError: Python int too large to convert to C int
k="${k-}${k+ and }not test_flush"
# These are a cluster of similar pyarrow/parquet tests with apparent endianness
# issues. It is not immediately obvious where the bug is—in the library or in
# the tests?
k="${k-}${k+ and }not (TestBasic and test_write_index[pyarrow])"
k="${k-}${k+ and }not (TestBasic and test_multiindex_with_columns)"
k="${k-}${k+ and }not (TestBasic and test_write_column_multiindex_string)"
k="${k-}${k+ and }not (TestBasic and test_write_column_index_string)"
k="${k-}${k+ and }not (TestBasic and test_use_nullable_dtypes[pyarrow])"
k="${k-}${k+ and }not (TestParquetPyArrow and test_basic)"
k="${k-}${k+ and }not (TestParquetPyArrow and test_to_bytes_without_path_or_buf_provided)"
k="${k-}${k+ and }not (TestParquetPyArrow and test_categorical)"
k="${k-}${k+ and }not (TestParquetPyArrow and test_additional_extension_arrays)"
k="${k-}${k+ and }not (TestParquetPyArrow and test_pyarrow_backed_string_array[python])"
k="${k-}${k+ and }not (TestParquetPyArrow and test_pyarrow_backed_string_array[pyarrow])"
k="${k-}${k+ and }not (TestParquetPyArrow and test_additional_extension_types)"
k="${k-}${k+ and }not (TestParquetPyArrow and test_timezone_aware_index[timezone_aware_date_list0])"
# Similarly, there are a cluster of similar stata test failures for which the
# root cause is not immediately obvious.
k="${k-}${k+ and }not (TestStata and test_writer_117)"
k="${k-}${k+ and }not (TestStata and test_convert_strl_name_swap)"
k="${k-}${k+ and }not (TestStata and test_strl_latin1)"
# Fails for [118], [119], and [None]
k="${k-}${k+ and }not (TestStata and test_utf8_writer)"
%endif
# Ensure pytest doesnt find the “un-built” library. We can get away with this
# approach because the tests are also in the installed library. We cant simply
# “cd” to the buildroots python3_sitearch because testing leaves files in the