Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test for h5netcdf invalid_netcdf warning is failing #3300

Closed
dcherian opened this issue Sep 10, 2019 · 0 comments · Fixed by #3301
Closed

test for h5netcdf invalid_netcdf warning is failing #3300

dcherian opened this issue Sep 10, 2019 · 0 comments · Fixed by #3301

Comments

@dcherian
Copy link
Contributor

dcherian commented Sep 10, 2019

This passes locally with h5py==2.9.0 but the CI is running h5py==2.10.0. It's probably issuing an extra warning.

=================================== FAILURES ===================================
_____________ TestH5NetCDFData.test_complex[None-FutureWarning-1] ______________

self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x7f4509fac358>
invalid_netcdf = None, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
_____________ TestH5NetCDFData.test_complex[False-FutureWarning-1] _____________

self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x7f450a96c748>
invalid_netcdf = False, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
__________________ TestH5NetCDFData.test_complex[True-None-0] __________________

self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x7f450aa69be0>
invalid_netcdf = True, warns = None, num_warns = 0

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 1 == 0
E        +  where 1 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
__________ TestH5NetCDFFileObject.test_complex[None-FutureWarning-1] ___________

self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x7f4509e1a8d0>
invalid_netcdf = None, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
__________ TestH5NetCDFFileObject.test_complex[False-FutureWarning-1] __________

self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x7f4509c749e8>
invalid_netcdf = False, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
_______________ TestH5NetCDFFileObject.test_complex[True-None-0] _______________

self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x7f450afe69b0>
invalid_netcdf = True, warns = None, num_warns = 0

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 1 == 0
E        +  where 1 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
__________ TestH5NetCDFViaDaskData.test_complex[None-FutureWarning-1] __________

self = <xarray.tests.test_backends.TestH5NetCDFViaDaskData object at 0x7f4509fa0c18>
invalid_netcdf = None, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
_________ TestH5NetCDFViaDaskData.test_complex[False-FutureWarning-1] __________

self = <xarray.tests.test_backends.TestH5NetCDFViaDaskData object at 0x7f4509e45e10>
invalid_netcdf = False, warns = <class 'FutureWarning'>, num_warns = 1

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 2 == 1
E        +  where 2 = len(WarningsChecker(record=True))

xarray/tests/test_backends.py:2185: AssertionError
______________ TestH5NetCDFViaDaskData.test_complex[True-None-0] _______________

self = <xarray.tests.test_backends.TestH5NetCDFViaDaskData object at 0x7f450aa3f668>
invalid_netcdf = True, warns = None, num_warns = 0

    @pytest.mark.filterwarnings("ignore:complex dtypes are supported by h5py")
    @pytest.mark.parametrize(
        "invalid_netcdf, warns, num_warns",
        [(None, FutureWarning, 1), (False, FutureWarning, 1), (True, None, 0)],
    )
    def test_complex(self, invalid_netcdf, warns, num_warns):
        expected = Dataset({"x": ("y", np.ones(5) + 1j * np.ones(5))})
        save_kwargs = {"invalid_netcdf": invalid_netcdf}
        with pytest.warns(warns) as record:
            with self.roundtrip(expected, save_kwargs=save_kwargs) as actual:
                assert_equal(expected, actual)
>       assert len(record) == num_warns
E       assert 1 == 0
E        +  where 1 = len(WarningsChecker(record=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant