You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running tests in astropy that import matplotlib, this warning appears, causing CI to fail when we turn warnings into errors, as shown below. I also see this warning when running the tests locally (though pytest complains about it, it did not result in error during test collection 🤷♀ ).
astropy/conftest.py:35: in pytest_configure
matplotlibrc_cache.update(matplotlib.rcParams)
.../matplotlib/__init__.py:886: in __getitem__
cbook.warn_deprecated(
.../matplotlib/cbook/deprecation.py:112: in warn_deprecated
warnings.warn(message, category, stacklevel=2)
E matplotlib.cbook.deprecation.MatplotlibDeprecationWarning:
E examples.directory is deprecated; in the future, examples will be found relative to the 'datapath' directory.
The problem doesn't exist in master anymore because examples.directory has been removed, but for future reference, you can use rcParams.copy() to turn the rcParams into a plain dict that doesnt warn on access. Alternatively, I would say the "correct" way to do the manipulation you do in pytest_{,un}configure is to use rc_context() (which also suppresses the warnings, and is faster when restoring the previous settings because it knows it doesn't need to revalidate them), but that's admittedly a but annoying because pytest_{,un}configure is split over two functions (probably something doable with ExitStack, yada yada).
I'm not really sure there's a way around this problem given that we want to warn when people use deprecated rcs, so I think this is closer to a feature than a bug... (the fact that copy() has an "escape latch" could in fact nearly be considered a bug)
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug summary
When running tests in
astropy
that importmatplotlib
, this warning appears, causing CI to fail when we turn warnings into errors, as shown below. I also see this warning when running the tests locally (thoughpytest
complains about it, it did not result in error during test collection 🤷♀ ).Code for reproduction
See astropy/astropy#9690
Actual outcome
Traceback as described above.
Expected outcome
No warning emitted, as it was supposedly fixed in #12658 .
Matplotlib version
print(matplotlib.get_backend())
): TkAgg (on local Windows 10 machine)astropy
and its test dependenciespip
installed into aconda
environment (on local machine)The text was updated successfully, but these errors were encountered: