Open-EO / openeo-python-client

Python client API for OpenEO
https://open-eo.github.io/openeo-python-client/
Apache License 2.0
147 stars 37 forks source link

introduce openeo.testing.results with reusable result comparison utilities for test suites #594

Closed soxofaan closed 2 weeks ago

soxofaan commented 1 month ago

This is a tracking ticket about new submodule openeo.testing.results, which I already added earlier (starting with feature branch merge 95e00f9a6ea6e0e645c6c6086a33266997bf0ae2 ). There wasn't a dedicated ticket in this repo for it (it was mainly targetting https://github.com/ESA-APEx/apex_algorithms/issues/5), but to better track further follow up I decided to create one here anyway

soxofaan commented 1 month ago

tests on python 3.11 are currently failing with

__ TestAssertXarray.test_assert_xarray_dataset_allclose_empty_coords_handling __
...
openeo/testing/results.py:132: in _compare_xarray_dataarray
    xarray.testing.assert_allclose(a=actual, b=expected, rtol=rtol, atol=atol)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/xarray/testing/assertions.py:274: in compat_variable
    return a.dims == b.dims and (a._data is b._data or equiv(a.data, b.data))
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/xarray/testing/assertions.py:45: in _data_allclose_or_equiv
    arr1 = _decode_string_data(arr1)
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/xarray/testing/assertions.py:39: in _decode_string_data
    return np.core.defchararray.decode(data, "utf-8", "replace")
/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/numpy/core/__init__.py:30: in __getattr__
    attr = getattr(_core, attr_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'defchararray'

    def __getattr__(name):
        # Deprecated 2022-11-22, NumPy 1.25.
        if name == "MachAr":
            import warnings
            warnings.warn(
                "The `np._core.MachAr` is considered private API (NumPy 1.24)",
                DeprecationWarning, stacklevel=2,
            )
            return _machar.MachAr
>       raise AttributeError(f"Module {__name__!r} has no attribute {name!r}")
E       AttributeError: Module 'numpy._core' has no attribute 'defchararray'

which looks like this issue https://github.com/pydata/xarray/issues/9165 (numpy2 compatibility problem)

soxofaan commented 2 weeks ago

I think it's fine to close this ticket for now. The initial implementation is there, used e.g. in https://github.com/ESA-APEx/apex_algorithms/issues/5 and available in recently released 0.31.0