Skip to content

Conversation

@feefladder
Copy link
Contributor

@feefladder feefladder commented Jul 2, 2021

@feefladder
Copy link
Contributor Author

feefladder commented Jul 2, 2021

Also there is an issue when:

cd xarray
pip install -e .
pip install h5netcdf pytest-xdist netcdf4
py.test -n 2 xarray/tests/test_backends.py
======================================================== FAILURES =========================================================
________________________________________ TestH5NetCDFFileObject.test_open_fileobj _________________________________________
[gw2] linux -- Python 3.9.5 /home/joeperdefloep/miniconda3/envs/xr-dev/bin/python3.9

self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x7f7e841a4220>

    def test_open_fileobj(self):
        # open in-memory datasets instead of local file paths
        expected = create_test_data().drop_vars("dim3")
        expected.attrs["foo"] = "bar"
        with create_tmp_file() as tmp_file:
            expected.to_netcdf(tmp_file, engine="h5netcdf")
    
            with open(tmp_file, "rb") as f:
                with open_dataset(f, engine="h5netcdf") as actual:
                    assert_identical(expected, actual)
    
                f.seek(0)
                with open_dataset(f) as actual:
                    assert_identical(expected, actual)
    
                f.seek(0)
                with BytesIO(f.read()) as bio:
                    with open_dataset(bio, engine="h5netcdf") as actual:
                        assert_identical(expected, actual)
    
                f.seek(0)
                with pytest.raises(TypeError, match="not a valid NetCDF 3"):
>                   open_dataset(f, engine="scipy")

/mnt/e/Git/xarray/xarray/tests/test_backends.py:2887: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/mnt/e/Git/xarray/xarray/backends/api.py:483: in open_dataset
    backend = plugins.get_backend(engine)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

engine = 'scipy'

    def get_backend(engine):
        """Select open_dataset method based on current engine."""
        if isinstance(engine, str):
            engines = list_engines()
            if engine not in engines:
>               raise ValueError(
                    f"unrecognized engine {engine} must be one of: {list(engines)}"
                )
E               ValueError: unrecognized engine scipy must be one of: ['netcdf4', 'h5netcdf', 'store']

/mnt/e/Git/xarray/xarray/backends/plugins.py:156: ValueError
================================================= short test summary info =================================================
FAILED xarray/tests/test_backends.py::TestH5NetCDFFileObject::test_open_fileobj - ValueError: unrecognized engine scipy ...
=========================== 1 failed, 458 passed, 818 skipped, 18 xfailed, 6 xpassed in 25.08s ===========================

@keewis
Copy link
Collaborator

keewis commented Jul 2, 2021

Good catch, @joeperdefloep, this should be fixed by decorating the test with requires_scipy. Could you make that change?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2021

Unit Test Results

         6 files           6 suites   52m 19s ⏱️
16 163 tests 14 448 ✔️ 1 715 💤 0 ❌
90 174 runs  82 061 ✔️ 8 113 💤 0 ❌

Results for commit fab8263.

♻️ This comment has been updated with latest results.

@dcherian
Copy link
Contributor

Looks great. Thanks @joeperdefloep . I see this is your first contribution to xarray. Welcome!

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 this pull request may close these issues.

Tests fail when installing h5netcdf without netcdf4

3 participants