Bug#1013754: python-h5netcdf: FTBFS with NetCDF 4.9.0 (test failures)

Bas Couwenberg sebastic at xs4all.nl
Sat Jun 25 13:30:45 BST 2022


Source: python-h5netcdf
Version: 1.0.0-3
Severity: serious
Tags: upstream patch ftbfs

Dear Maintainer,

Your package FTBFS with NetCDF 4.9.0 which added more compression options, this also causes the autopkgtest to fail:

=================================== FAILURES ===================================
______________________ test_write_legacyapi_read_netCDF4 _______________________

tmp_local_netcdf = '/tmp/pytest-of-debci/pytest-0/test_write_legacyapi_read_netC0/testfile.nc'

    def test_write_legacyapi_read_netCDF4(tmp_local_netcdf):
>       roundtrip_legacy_netcdf(tmp_local_netcdf, netCDF4, legacyapi)

tests/test_h5netcdf.py:450: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_h5netcdf.py:446: in roundtrip_legacy_netcdf
    read_legacy_netcdf(tmp_netcdf, read_module, write_module)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tmp_netcdf = '/tmp/pytest-of-debci/pytest-0/test_write_legacyapi_read_netC0/testfile.nc'
read_module = <module 'netCDF4' from '/usr/lib/python3/dist-packages/netCDF4/__init__.py'>
write_module = <module 'h5netcdf.legacyapi' from '/usr/lib/python3/dist-packages/h5netcdf/legacyapi.py'>

    def read_legacy_netcdf(tmp_netcdf, read_module, write_module):
        ds = read_module.Dataset(tmp_netcdf, "r")
        assert ds.ncattrs() == ["global", "other_attr"]
        assert ds.getncattr("global") == 42
        if write_module is not netCDF4:
            # skip for now: https://github.com/Unidata/netcdf4-python/issues/388
            assert ds.other_attr == "yes"
        with pytest.raises(AttributeError):
            ds.does_not_exist
        assert set(ds.dimensions) == set(
            ["x", "y", "z", "empty", "string3", "mismatched_dim", "unlimited"]
        )
        assert set(ds.variables) == set(
            [
                "foo",
                "y",
                "z",
                "intscalar",
                "scalar",
                "var_len_str",
                "mismatched_dim",
                "foo_unlimited",
            ]
        )
    
        assert set(ds.groups) == set(["subgroup"])
        assert ds.parent is None
        v = ds.variables["foo"]
        assert array_equal(v, np.ones((4, 5)))
        assert v.dtype == float
        assert v.dimensions == ("x", "y")
        assert v.ndim == 2
        assert v.ncattrs() == ["units"]
        if write_module is not netCDF4:
            assert v.getncattr("units") == "meters"
        assert tuple(v.chunking()) == (4, 5)
>       assert v.filters() == {
            "complevel": 4,
            "fletcher32": False,
            "shuffle": True,
            "zlib": True,
        }
E       AssertionError: assert {'blosc': Fal...': False, ...} == {'complevel':... 'zlib': True}
E         Omitting 4 identical items, use -vv to show
E         Left contains 4 more items:
E         {'blosc': False, 'bzip2': False, 'szip': False, 'zstd': False}
E         Use -v to get the full diff

tests/test_h5netcdf.py:259: AssertionError
_______________________ test_write_h5netcdf_read_netCDF4 _______________________

tmp_local_netcdf = '/tmp/pytest-of-debci/pytest-0/test_write_h5netcdf_read_netCD0/testfile.nc'

    def test_write_h5netcdf_read_netCDF4(tmp_local_netcdf):
        write_h5netcdf(tmp_local_netcdf)
>       read_legacy_netcdf(tmp_local_netcdf, netCDF4, h5netcdf)

tests/test_h5netcdf.py:468: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tmp_netcdf = '/tmp/pytest-of-debci/pytest-0/test_write_h5netcdf_read_netCD0/testfile.nc'
read_module = <module 'netCDF4' from '/usr/lib/python3/dist-packages/netCDF4/__init__.py'>
write_module = <module 'h5netcdf' from '/usr/lib/python3/dist-packages/h5netcdf/__init__.py'>

    def read_legacy_netcdf(tmp_netcdf, read_module, write_module):
        ds = read_module.Dataset(tmp_netcdf, "r")
        assert ds.ncattrs() == ["global", "other_attr"]
        assert ds.getncattr("global") == 42
        if write_module is not netCDF4:
            # skip for now: https://github.com/Unidata/netcdf4-python/issues/388
            assert ds.other_attr == "yes"
        with pytest.raises(AttributeError):
            ds.does_not_exist
        assert set(ds.dimensions) == set(
            ["x", "y", "z", "empty", "string3", "mismatched_dim", "unlimited"]
        )
        assert set(ds.variables) == set(
            [
                "foo",
                "y",
                "z",
                "intscalar",
                "scalar",
                "var_len_str",
                "mismatched_dim",
                "foo_unlimited",
            ]
        )
    
        assert set(ds.groups) == set(["subgroup"])
        assert ds.parent is None
        v = ds.variables["foo"]
        assert array_equal(v, np.ones((4, 5)))
        assert v.dtype == float
        assert v.dimensions == ("x", "y")
        assert v.ndim == 2
        assert v.ncattrs() == ["units"]
        if write_module is not netCDF4:
            assert v.getncattr("units") == "meters"
        assert tuple(v.chunking()) == (4, 5)
>       assert v.filters() == {
            "complevel": 4,
            "fletcher32": False,
            "shuffle": True,
            "zlib": True,
        }
E       AssertionError: assert {'blosc': Fal...': False, ...} == {'complevel':... 'zlib': True}
E         Omitting 4 identical items, use -vv to show
E         Left contains 4 more items:
E         {'blosc': False, 'bzip2': False, 'szip': False, 'zstd': False}
E         Use -v to get the full diff

tests/test_h5netcdf.py:259: AssertionError
=========================== short test summary info ============================
FAILED tests/test_h5netcdf.py::test_write_legacyapi_read_netCDF4 - AssertionE...
FAILED tests/test_h5netcdf.py::test_write_h5netcdf_read_netCDF4 - AssertionEr...
=================== 2 failed, 69 passed, 22 skipped in 2.44s ===================


The attached patch fixes the issue.

Kind Regards,

Bas
-------------- next part --------------
diff -Nru python-h5netcdf-1.0.0/debian/changelog python-h5netcdf-1.0.0/debian/changelog
--- python-h5netcdf-1.0.0/debian/changelog	2022-04-12 02:20:27.000000000 +0200
+++ python-h5netcdf-1.0.0/debian/changelog	2022-06-25 14:08:53.000000000 +0200
@@ -1,3 +1,10 @@
+python-h5netcdf (1.0.0-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch to fix FTBFS with NetCDF 4.9.0.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Sat, 25 Jun 2022 14:08:53 +0200
+
 python-h5netcdf (1.0.0-3) unstable; urgency=medium
 
   * Team upload.
diff -Nru python-h5netcdf-1.0.0/debian/patches/netcdf-4.9.0.patch python-h5netcdf-1.0.0/debian/patches/netcdf-4.9.0.patch
--- python-h5netcdf-1.0.0/debian/patches/netcdf-4.9.0.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-h5netcdf-1.0.0/debian/patches/netcdf-4.9.0.patch	2022-06-25 14:08:53.000000000 +0200
@@ -0,0 +1,41 @@
+Description: Fix test failure with NetCDF 4.9.0.
+Author: Bas Couwenberg <sebastic at debian.org>
+
+--- a/h5netcdf/tests/test_h5netcdf.py
++++ b/h5netcdf/tests/test_h5netcdf.py
+@@ -256,12 +256,11 @@ def read_legacy_netcdf(tmp_netcdf, read_
+     if write_module is not netCDF4:
+         assert v.getncattr("units") == "meters"
+     assert tuple(v.chunking()) == (4, 5)
+-    assert v.filters() == {
+-        "complevel": 4,
+-        "fletcher32": False,
+-        "shuffle": True,
+-        "zlib": True,
+-    }
++    filters = v.filters()
++    assert filters['complevel'] == 4
++    assert filters['fletcher32'] is False
++    assert filters['shuffle'] is True
++    assert filters['zlib'] is True
+ 
+     v = ds.variables["y"]
+     assert array_equal(v, np.r_[np.arange(4), [-1]])
+@@ -271,12 +270,11 @@ def read_legacy_netcdf(tmp_netcdf, read_
+     assert v.ncattrs() == ["_FillValue"]
+     assert v.getncattr("_FillValue") == -1
+     assert v.chunking() == "contiguous"
+-    assert v.filters() == {
+-        "complevel": 0,
+-        "fletcher32": False,
+-        "shuffle": False,
+-        "zlib": False,
+-    }
++    filters = v.filters()
++    assert filters['complevel'] == 0
++    assert filters['fletcher32'] is False
++    assert filters['shuffle'] is False
++    assert filters['zlib'] is False
+     ds.close()
+ 
+     # Check the behavior if h5py. Cannot expect h5netcdf to overcome these
diff -Nru python-h5netcdf-1.0.0/debian/patches/series python-h5netcdf-1.0.0/debian/patches/series
--- python-h5netcdf-1.0.0/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ python-h5netcdf-1.0.0/debian/patches/series	2022-06-25 14:05:51.000000000 +0200
@@ -0,0 +1 @@
+netcdf-4.9.0.patch


More information about the debian-science-maintainers mailing list