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

Cleanup warnings from tests #3255

Merged
merged 36 commits into from
Dec 14, 2023
Merged

Conversation

dopplershift
Copy link
Member

Description Of Changes

Working to get rid of all the warnings that are spewed out by our tests.

@dopplershift dopplershift added Type: Maintenance Updates and clean ups (but not wrong) Area: Tests Affects tests hacktoberfest-accepted PRs accepted for contributions in hacktoberfest labels Oct 31, 2023
@dopplershift dopplershift added this to the October 2023 milestone Oct 31, 2023
@dopplershift dopplershift marked this pull request as ready for review October 31, 2023 22:35
@dopplershift dopplershift requested review from dcamron and removed request for a team October 31, 2023 22:35
tests/io/test_gempak.py Fixed Show fixed Hide fixed
tests/io/test_gempak.py Fixed Show fixed Hide fixed
@akrherz
Copy link
Contributor

akrherz commented Nov 1, 2023

I like this PR a lot! :) I would say though I was confused by the title of "Silence Warnings", which implies to me a bunch of warnings.filter('ignore', BlahWarning) were added to the code base. Instead, lots of things were addressed to fix the warnings from being generated!

@dopplershift dopplershift changed the title Silence warnings Cleanup warnings from tests Nov 1, 2023
src/metpy/calc/thermo.py Outdated Show resolved Hide resolved
@dopplershift dopplershift force-pushed the silence-warnings branch 3 times, most recently from cf52348 to 26ee990 Compare November 3, 2023 22:21
@dopplershift
Copy link
Member Author

Ugh, annoying. I used our "new" matplotlib version checking functions to avoid a deprecation warning in declarative, but that's in testing, which pulls in pytest. Guess we need to move that somewhere else or...?

tests/plots/test_declarative.py Dismissed Show dismissed Hide dismissed
tests/plots/test_util.py Dismissed Show dismissed Hide dismissed
@kgoebber
Copy link
Collaborator

kgoebber commented Nov 7, 2023

What about putting the version checking of matplotlib in plots/_mpl.py? No ideal location, but that might make some sense.

@dopplershift
Copy link
Member Author

@kgoebber My local draft has a commit that looks for a specific attribute on a class in Matplotlib. This avoids the location of that function as well as incurring a hard dependency on packaging for MetPy itself.

@dopplershift dopplershift force-pushed the silence-warnings branch 5 times, most recently from 4101659 to 41627a0 Compare November 8, 2023 21:49
@dopplershift
Copy link
Member Author

With this we bump minimum scipy to 1.8.0, which is the first version that has QhullError available as a public symbol in scipy.spatial, which is one of the deprecation warnings we're avoiding. Scipy 1.8.0 was released 5 February 2022, which puts us a little ahead of schedule, but not too bad.

@dopplershift dopplershift force-pushed the silence-warnings branch 3 times, most recently from 3b2cac8 to a7c0b5b Compare November 14, 2023 23:48
These aren't necessarily correct, but fully fixing/eliminating them out
of the advection call is difficult.
pytest-mpl handles it for figures we compare, but we need to manually
close other figures we generate.
Matplotlib 3.8 deprecated the collections attribute on ContourSet.
Avoid passing Quantity instances to matplotlib plots that don't support
them in the declarative interface.
Python 3.12 deprecated UTC tz-naive methods utcnow() and
utcfromtimestamp(). This adds a filter for one import-time warning from
dateutil.

Our approach here maintains using tz-naive objects afterwards for
user-accessible objects.
This allows the tests to pass properly on a "minimum" config on my mac M2.
These are inevitable when you do mod/remainder on a nan, but we're
perfectly happy to get nan back.
These are a natural consequence of masked data/trying to trigger error
conditions.
This avoids needing to interpolate an LCL below our bottom pressure.
These aren't planned to be addressed until well after numpy 2.0 is
released.
Most of this is fixed by passing filenames, rather than file objects, to
pandas/numpy so that they have ownership.
Adds a few missing files that were triggering downloads in tests.
This is to avoid a warning from setuptools_scm.
Moves to 0.21.0, 1.4.0, and 0.17, respectively. These are on the edge of
our window but they help avoid deprecation warnings.
@dcamron dcamron merged commit 6a9cddc into Unidata:main Dec 14, 2023
34 checks passed
@dopplershift dopplershift deleted the silence-warnings branch December 15, 2023 00:12
dopplershift added a commit to dopplershift/MetPy that referenced this pull request Jan 3, 2024
The fixup in Unidata#3255 inadvertently added unit parsing to all code paths in
interpolate_to_slice. This breaks any usages that passed in data with
unknown units. Since interpolate_to_slice has no need to do any unit
handling, avoid this unless we're actually given a quantity.
dopplershift added a commit to dopplershift/MetPy that referenced this pull request Jan 3, 2024
The fixup in Unidata#3255 inadvertently added unit parsing to all code paths in
interpolate_to_slice. This breaks any usages that passed in data with
unknown units. Since interpolate_to_slice has no need to do any unit
handling, avoid this unless we're actually given a quantity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tests Affects tests hacktoberfest-accepted PRs accepted for contributions in hacktoberfest Type: Maintenance Updates and clean ups (but not wrong)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants