Conversation
The current version of pytest is warning that using `importorskip` to catch `ImportError` will start being ignored (and thus raising) with pytest 9. Fortunately, in all cases, we don't need these calls, as they are: - already checked for `ImportError` at the top-level of the file - already checked by the backend switcher - not actually possible to fail importing
| test_backend = pytest.importorskip( | ||
| f'matplotlib.backends.backend_{backend}' | ||
| ) | ||
| test_backend = importlib.import_module(f'matplotlib.backends.backend_{backend}') |
There was a problem hiding this comment.
backend here is svg, ps, pdf, or pgf, which are not expected to fail (maybe they used to when Pillow was optional?)
There was a problem hiding this comment.
maybe crossed streams with the mark on the pgf parameter?
| pytest.importorskip("matplotlib.backends.backend_gtk3agg") | ||
|
|
||
|
|
||
| @pytest.mark.backend("gtk3agg", skip_on_importerror=True) |
There was a problem hiding this comment.
This is the only test, so the backend switch covers the import check.
| qt_compat = pytest.importorskip('matplotlib.backends.qt_compat') | ||
| QtCore = qt_compat.QtCore | ||
|
|
||
| from matplotlib.backends.qt_compat import QtCore |
There was a problem hiding this comment.
qt_compat is checked above on line 18, and the whole module is skipped.
Doesn't that defeat the purpose of |
They plan to only catch |
|
Ah ha! I completely missed the addition of ModuleNotFound (which was in 3.6) so this makes sense. |
…195-on-v3.9.x Backport PR #28195 on branch v3.9.x (TST: Prepare for pytest 9)
PR summary
The current version of pytest is warning that using
importorskipto catchImportErrorwill start being ignored (and thus raising) with pytest 9.Fortunately, in all cases, we don't need these calls, as they are:
ImportErrorat the top-level of the filePR checklist