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

ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. #3301

Merged
merged 6 commits into from
Sep 13, 2019

Conversation

dcherian
Copy link
Contributor

Just increased expected number of warnings by 1 till h5netcdf is fixed to not throw a warning (xref h5netcdf/h5netcdf#62)

@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)],
Copy link
Member

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

Copy link
Contributor Author

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.

@shoyer
Copy link
Member

shoyer commented Sep 12, 2019

thanks @dcherian ! it will be great to clean this up :)

@dcherian
Copy link
Contributor Author

🤦‍♂️ now failure is #3303

@dcherian dcherian mentioned this pull request Sep 13, 2019
@max-sixty
Copy link
Collaborator

Shall we merge?

@dcherian
Copy link
Contributor Author

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.

@shoyer shoyer merged commit e90e8bc into pydata:master Sep 13, 2019
@dcherian dcherian deleted the h5py-warning branch September 13, 2019 15:44
dcherian added a commit to dcherian/xarray that referenced this pull request Sep 13, 2019
* 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)
dcherian added a commit to dcherian/xarray that referenced this pull request Sep 19, 2019
* 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)
dcherian added a commit that referenced this pull request Sep 24, 2019
* 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)
  ...
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.

test for h5netcdf invalid_netcdf warning is failing
3 participants