Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TST: Prepare for pytest 9#28195

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:mainfromQuLogic:pytest9
May 9, 2024
Merged

Conversation

QuLogic
Copy link
Member

PR summary

The current version of pytest is warning that usingimportorskip to catchImportError 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 forImportError at the top-level of the file
  • already checked by the backend switcher
  • not actually possible to fail importing

PR checklist

The current version of pytest is warning that using `importorskip` tocatch `ImportError` will start being ignored (and thus raising) withpytest 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
@QuLogicQuLogic added this to thev3.9.1 milestoneMay 9, 2024
test_backend = pytest.importorskip(
f'matplotlib.backends.backend_{backend}'
)
test_backend = importlib.import_module(f'matplotlib.backends.backend_{backend}')
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

backend here is svg, ps, pdf, or pgf, which are not expected to fail (maybe they used to when Pillow was optional?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe crossed streams with the mark on the pgf parameter?

@@ -3,9 +3,6 @@
import pytest


pytest.importorskip("matplotlib.backends.backend_gtk3agg")


@pytest.mark.backend("gtk3agg", skip_on_importerror=True)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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
Copy link
MemberAuthor

@QuLogicQuLogicMay 9, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

qt_compat is checked above on line 18, and the whole module is skipped.

@tacaswell
Copy link
Member

importorskip to catch ImportError will start being ignored (and thus raising) with pytest 9.

Doesn't that defeat the purpose ofimportorskip ?!

@QuLogic
Copy link
MemberAuthor

importorskip to catch ImportError will start being ignored (and thus raising) with pytest 9.

Doesn't that defeat the purpose ofimportorskip ?!

They plan to only catchModuleNotFoundError by default in the future:https://docs.pytest.org/en/8.2.x/deprecations.html#pytest-importorskip-default-behavior-regarding-importerror

@tacaswell
Copy link
Member

Ah ha! I completely missed the addition of ModuleNotFound (which was in 3.6) so this makes sense.

@tacaswelltacaswell merged commiteb17273 intomatplotlib:mainMay 9, 2024
41 of 43 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMay 9, 2024
@QuLogicQuLogic deleted the pytest9 branchMay 9, 2024 21:03
timhoffm added a commit that referenced this pull requestMay 10, 2024
…195-on-v3.9.xBackport PR#28195 on branch v3.9.x (TST: Prepare for pytest 9)
@QuLogicQuLogic modified the milestones:v3.9.1,v3.9.0May 10, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@ksundenksundenksunden approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.9.0
Development

Successfully merging this pull request may close these issues.

3 participants
@QuLogic@tacaswell@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp