ecmwf / pdbufr

High-level BUFR interface for ecCodes
Apache License 2.0
23 stars 8 forks source link

Test failure with pandas 2.1.1 #71

Closed iainrussell closed 10 months ago

iainrussell commented 10 months ago

What happened?

Test 'test_sat_compressed_1' fails with this error:

>       assert_frame_equal(res[0:1], ref_1[res.columns])
E       AssertionError: Attributes of DataFrame.iloc[:, 6] (column name="data_datetime") are different
E
E       Attribute "dtype" are different
E       [left]:  datetime64[ns]
E       [right]: datetime64[s]

This test works with pandas 2.0.3, but fails with 2.1.1. This looks like the reason: https://github.com/pandas-dev/pandas/pull/52212

In our tests, we use various ways to create a reference pandas DataFrame. This particular test uses a way that used to generate an 'ns' datetime, but with the new pandas version it generates an 's' datetime. The solution is simply to specify 'ns' when creating the reference datetimes.

What are the steps to reproduce the bug?

pytest -s -k test_sat_compressed_1

Version

0.11.0

Platform (OS and architecture)

Linux and MacOS

Relevant log output

No response

Accompanying data

No response

Organisation

ECMWF

iainrussell commented 10 months ago

Fixed via PR https://github.com/ecmwf/pdbufr/pull/72