Open
Description
What happened?
We building xarray in Mageia for 64 bits and 32 arches, Intel and ARM.
But the build fails in 32bits Intel:
=================================== FAILURES ===================================
____________________________ TestDataset.test_repr _____________________________
self = <xarray.tests.test_dataset.TestDataset object at 0xf00a43a0>
def test_repr(self) -> None:
data = create_test_data(seed=123, use_extension_array=True)
data.attrs["foo"] = "bar"
# need to insert str dtype at runtime to handle different endianness
var5 = (
"\n var5 (dim1) int64[pyarrow] 64B 5 9 7 2 6 2 8 1"
if has_pyarrow
else ""
)
expected = dedent(
f"""\
<xarray.Dataset> Size: 2kB
Dimensions: (dim2: 9, dim3: 10, time: 20, dim1: 8)
Coordinates:
* dim2 (dim2) float64 72B 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
* dim3 (dim3) {data["dim3"].dtype} 40B 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j'
* time (time) datetime64[ns] 160B 2000-01-01 2000-01-02 ... 2000-01-20
numbers (dim3) int64 80B 0 1 2 0 0 1 1 2 2 3
Dimensions without coordinates: dim1
Data variables:
var1 (dim1, dim2) float64 576B -0.9891 -0.3678 1.288 ... -0.2116 0.364
var2 (dim1, dim2) float64 576B 0.953 1.52 1.704 ... 0.1347 -0.6423
var3 (dim3, dim1) float64 640B 0.4107 0.9941 0.1665 ... 0.716 1.555
var4 (dim1) category 32B b c b a c a c a{var5}
Attributes:
foo: bar"""
)
actual = "\n".join(x.rstrip() for x in repr(data).split("\n"))
> assert expected == actual
E AssertionError: assert '<xarray.Data...foo: bar' == '<xarray.Data...foo: bar'
E
E Skipping 657 identical leading characters in diff, use -v to show
E Skipping 38 identical trailing characters in diff, use -v to show
E - category 20B b c b a
E ? -
E + category 32B b c b a
E ? +
/builddir/build/BUILD/python-xarray-2025.06.1-build/xarray-2025.06.1/xarray/tests/test_dataset.py:308: AssertionError
______________________ TestRepr.test_repr_truncates_nodes ______________________
self = <xarray.tests.test_datatree.TestRepr object at 0xef9c90d8>
def test_repr_truncates_nodes(self) -> None:
# construct a datatree with 50 nodes
number_of_files = 10
number_of_groups = 5
tree_dict = {}
for f in range(number_of_files):
for g in range(number_of_groups):
tree_dict[f"file_{f}/group_{g}"] = Dataset({"g": f * g})
tree = DataTree.from_dict(tree_dict)
with xr.set_options(display_max_children=3):
result = repr(tree)
expected = dedent(
"""
<xarray.DataTree>
Group: /
├── Group: /file_0
│ ├── Group: /file_0/group_0
│ │ Dimensions: ()
│ │ Data variables:
│ │ g int64 8B 0
│ ├── Group: /file_0/group_1
│ │ Dimensions: ()
│ │ Data variables:
│ │ g int64 8B 0
│ ...
│ └── Group: /file_0/group_4
│ Dimensions: ()
│ Data variables:
│ g int64 8B 0
├── Group: /file_1
│ ├── Group: /file_1/group_0
│ │ Dimensions: ()
│ │ Data variables:
│ │ g int64 8B 0
│ ├── Group: /file_1/group_1
│ │ Dimensions: ()
│ │ Data variables:
│ │ g int64 8B 1
│ ...
│ └── Group: /file_1/group_4
│ Dimensions: ()
│ Data variables:
│ g int64 8B 4
...
└── Group: /file_9
├── Group: /file_9/group_0
│ Dimensions: ()
│ Data variables:
│ g int64 8B 0
├── Group: /file_9/group_1
│ Dimensions: ()
│ Data variables:
│ g int64 8B 9
...
└── Group: /file_9/group_4
Dimensions: ()
Data variables:
g int64 8B 36
"""
).strip()
> assert expected == result
E AssertionError: assert '<xarray.Data... int64 8B 36' == '<xarray.Data... int32 4B 36'
E
E Skipping 151 identical leading characters in diff, use -v to show
E - int32 4B 0
E ? ^^^
E + int64 8B 0
E ? ^ ++
E │ ├── Group: /file_0/group_1...
E
E ...Full output truncated (61 lines hidden), use '-vv' to show
/builddir/build/BUILD/python-xarray-2025.06.1-build/xarray-2025.06.1/xarray/tests/test_datatree.py:1284: AssertionError
__________________________ TestRepr.test_doc_example ___________________________
self = <xarray.tests.test_datatree.TestRepr object at 0xef9bc350>
@pytest.mark.skipif(
ON_WINDOWS, reason="windows (pre NumPy2) uses int32 instead of int64"
)
def test_doc_example(self) -> None:
# regression test for https://github.com/pydata/xarray/issues/9499
time = xr.DataArray(
data=np.array(["2022-01", "2023-01"], dtype="<U7"), dims="time"
)
stations = xr.DataArray(
data=np.array(list("abcdef"), dtype="<U1"), dims="station"
)
lon = [-100, -80, -60]
lat = [10, 20, 30]
# Set up fake data
wind_speed = xr.DataArray(np.ones((2, 6)) * 2, dims=("time", "station"))
pressure = xr.DataArray(np.ones((2, 6)) * 3, dims=("time", "station"))
air_temperature = xr.DataArray(np.ones((2, 6)) * 4, dims=("time", "station"))
dewpoint = xr.DataArray(np.ones((2, 6)) * 5, dims=("time", "station"))
infrared = xr.DataArray(np.ones((2, 3, 3)) * 6, dims=("time", "lon", "lat"))
true_color = xr.DataArray(np.ones((2, 3, 3)) * 7, dims=("time", "lon", "lat"))
tree = xr.DataTree.from_dict(
{
"/": xr.Dataset(
coords={"time": time},
),
"/weather": xr.Dataset(
coords={"station": stations},
data_vars={
"wind_speed": wind_speed,
"pressure": pressure,
},
),
"/weather/temperature": xr.Dataset(
data_vars={
"air_temperature": air_temperature,
"dewpoint": dewpoint,
},
),
"/satellite": xr.Dataset(
coords={"lat": lat, "lon": lon},
data_vars={
"infrared": infrared,
"true_color": true_color,
},
),
},
)
result = repr(tree)
expected = dedent(
"""
<xarray.DataTree>
Group: /
│ Dimensions: (time: 2)
│ Coordinates:
│ * time (time) <U7 56B '2022-01' '2023-01'
├── Group: /weather
│ │ Dimensions: (station: 6, time: 2)
│ │ Coordinates:
│ │ * station (station) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'
│ │ Data variables:
│ │ wind_speed (time, station) float64 96B 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0
│ │ pressure (time, station) float64 96B 3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0
│ └── Group: /weather/temperature
│ Dimensions: (time: 2, station: 6)
│ Data variables:
│ air_temperature (time, station) float64 96B 4.0 4.0 4.0 4.0 ... 4.0 4.0 4.0
│ dewpoint (time, station) float64 96B 5.0 5.0 5.0 5.0 ... 5.0 5.0 5.0
└── Group: /satellite
Dimensions: (lat: 3, lon: 3, time: 2)
Coordinates:
* lat (lat) int64 24B 10 20 30
* lon (lon) int64 24B -100 -80 -60
Data variables:
infrared (time, lon, lat) float64 144B 6.0 6.0 6.0 6.0 ... 6.0 6.0 6.0
true_color (time, lon, lat) float64 144B 7.0 7.0 7.0 7.0 ... 7.0 7.0 7.0
"""
).strip()
> assert result == expected
E AssertionError: assert '<xarray.Data.... 7.0 7.0 7.0' == '<xarray.Data.... 7.0 7.0 7.0'
E
E Skipping 897 identical leading characters in diff, use -v to show
E Skipping 201 identical trailing characters in diff, use -v to show
E - (lat) int64 24B 10 20 30
E ? ^^^ ^
E + (lat) int32 12B 10 20 30
E ? ^ ^^^...
E
E ...Full output truncated (4 lines hidden), use '-vv' to show
/builddir/build/BUILD/python-xarray-2025.06.1-build/xarray-2025.06.1/xarray/tests/test_datatree.py:1409: AssertionError
=============================== warnings summary ===============================
xarray/tests/test_computation.py: 16 warnings
/usr/lib/python3.13/site-packages/numpy/lib/_nanfunctions_impl.py:2053: RuntimeWarning: Degrees of freedom <= 0 for slice.
var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED xarray/tests/test_dataset.py::TestDataset::test_repr - AssertionError:...
FAILED xarray/tests/test_datatree.py::TestRepr::test_repr_truncates_nodes - A...
FAILED xarray/tests/test_datatree.py::TestRepr::test_doc_example - AssertionE...
= 3 failed, 6448 passed, 8945 skipped, 12 xfailed, 4 xpassed, 16 warnings in 53.25s =
Is this test results really harmful?
What did you expect to happen?
tests pass
Minimal Complete Verifiable Example
MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
- Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
Anything else we need to know?
No response
Environment
python3-numpy: 2.1.3
python 3.13
xarray 2025.06.1