ecmwf / eccodes-python

Python interface to the ecCodes GRIB/BUFR decoder/encoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

one failing testcase when upgrading eccodes from 2.18.0 to 2.19.0

jdkloe opened this issue · comments

If I execute the tests after building and installing the eccodes python module version 0.9.9 all 54 tests pass when I have eccodes v2.18.0 installed.
However, when I upgrade to eccodes v2.19.0 I see one failing testcase:
tests/test_eccodes.py::test_bufr_keys_iterator FAILED [ 87%]

It gives these details:

________________________________ test_bufr_keys_iterator _________________________________

    def test_bufr_keys_iterator():
        bid = codes_bufr_new_from_samples("BUFR3_local_satellite")
        # Header keys only
        iterid = codes_bufr_keys_iterator_new(bid)
        count = 0
        while codes_bufr_keys_iterator_next(iterid):
            keyname = codes_bufr_keys_iterator_get_name(iterid)
            assert "#" not in keyname
            count += 1
>       assert count == 53
E       assert 54 == 53
E         -54
E         +53

tests/test_eccodes.py:540: AssertionError
========================== 1 failed, 53 passed in 1.13 seconds ===========================

If I manually adjust this count 53 and modify it to be 54, I get another test failure:

________________________________ test_bufr_keys_iterator _________________________________

    def test_bufr_keys_iterator():
        bid = codes_bufr_new_from_samples("BUFR3_local_satellite")
        # Header keys only
        iterid = codes_bufr_keys_iterator_new(bid)
        count = 0
        while codes_bufr_keys_iterator_next(iterid):
            keyname = codes_bufr_keys_iterator_get_name(iterid)
            assert "#" not in keyname
            count += 1
        assert count == 54
    
        codes_set(bid, "unpack", 1)
        codes_bufr_keys_iterator_rewind(iterid)
        count = 0
        while codes_bufr_keys_iterator_next(iterid):
            keyname = codes_bufr_keys_iterator_get_name(iterid)
            count += 1
>       assert count == 156
E       assert 157 == 156
E         -157
E         +156

tests/test_eccodes.py:548: AssertionError
========================== 1 failed, 53 passed in 1.25 seconds ===========================

Changing this 156 to 157 finally lets me run the test sequence without any failures.
So it seems with the new eccodes 2.19.0 the number of BUFR keys has increased by one?
Please investigate and fix this if needed in the test script.

I have removed the check on the exact count of keys as often we add new keys