-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. #3301
Conversation
@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)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could just remove the assert len(record) == num_warns
line below? I think pytest already verifies that we get a warning with pytest.warns
.
We can use the match
argument if we want to keep it more specific: https://docs.pytest.org/en/latest/warnings.html#warns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the complication is testing that the warning is not raised when invalid_netcdf=True
. I've changed it to count the number of warnings with the specified warning type and message so that it's more robust.
thanks @dcherian ! it will be great to clean this up :) |
This reverts commit 14ae0b1.
🤦♂️ now failure is #3303 |
Shall we merge? |
I think so. We are testing that there are a specific number of warnings with a specified message. I couldn't find any pytest functionality that makes writing that test easier so I implemented it manually. |
* upstream/master: ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. (pydata#3301) Update why-xarray.rst with clearer expression (pydata#3307) Updater to testing environment name (pydata#3253)
* master: Fix whats-new date :/ Revert to dev version Release v0.13.0 auto_combine deprecation to 0.14 (pydata#3314) Deprecation: groupby, resample default dim. (pydata#3313) Raise error if cmap is list of colors (pydata#3310) Refactor concat to use merge for non-concatenated variables (pydata#3239) Honor `keep_attrs` in DataArray.quantile (pydata#3305) Fix DataArray api doc (pydata#3309) Accept int value in head, thin and tail (pydata#3298) ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. (pydata#3301) Update why-xarray.rst with clearer expression (pydata#3307) Compat and encoding deprecation to 0.14 (pydata#3294) Remove deprecated concat kwargs. (pydata#3288) allow np-array levels and colors in 2D plots (pydata#3295) Remove some deprecations (pydata#3292) Make argmin/max work lazy with dask (pydata#3244) Add head, tail and thin methods (pydata#3278) Updater to testing environment name (pydata#3253)
* upstream/master: (43 commits) Add hypothesis support to related projects (#3335) More doc fixes (#3333) Improve the documentation of swap_dims (#3331) fix the doc names of the return value of swap_dims (#3329) Fix isel performance regression (#3319) Allow weakref (#3318) Clarify that "scatter" is a plotting method in what's new. (#3316) Fix whats-new date :/ Revert to dev version Release v0.13.0 auto_combine deprecation to 0.14 (#3314) Deprecation: groupby, resample default dim. (#3313) Raise error if cmap is list of colors (#3310) Refactor concat to use merge for non-concatenated variables (#3239) Honor `keep_attrs` in DataArray.quantile (#3305) Fix DataArray api doc (#3309) Accept int value in head, thin and tail (#3298) ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. (#3301) Update why-xarray.rst with clearer expression (#3307) Compat and encoding deprecation to 0.14 (#3294) ...
black . && mypy . && flake8
Just increased expected number of warnings by 1 till
h5netcdf
is fixed to not throw a warning (xref h5netcdf/h5netcdf#62)