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

Commit5b5154d

Browse files
authored
Merge pull request#27422 from QuLogic/test-cache-display
TST: Cache available interactive backends
2 parentsd8e272f +73b2152 commit5b5154d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
importfunctools
12
importimportlib
23
importimportlib.util
34
importinspect
@@ -52,7 +53,10 @@ def wait_for(self, terminator):
5253
# PyPI-installable on CI. They are not available for all tested Python
5354
# versions so we don't fail on missing backends.
5455

55-
def_get_testable_interactive_backends():
56+
@functools.lru_cache
57+
def_get_available_interactive_backends():
58+
_is_linux_and_display_invalid= (sys.platform=="linux"and
59+
not_c_internal_utils.display_is_valid())
5660
envs= []
5761
fordeps,envin [
5862
*[([qt_api],
@@ -70,8 +74,7 @@ def _get_testable_interactive_backends():
7074
]:
7175
reason=None
7276
missing= [depfordepindepsifnotimportlib.util.find_spec(dep)]
73-
if (sys.platform=="linux"and
74-
not_c_internal_utils.display_is_valid()):
77+
if_is_linux_and_display_invalid:
7578
reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
7679
elifmissing:
7780
reason="{} cannot be imported".format(", ".join(missing))
@@ -85,8 +88,7 @@ def _get_testable_interactive_backends():
8588
reason="no usable GTK bindings"
8689
marks= []
8790
ifreason:
88-
marks.append(pytest.mark.skip(
89-
reason=f"Skipping{env} because{reason}"))
91+
marks.append(pytest.mark.skip(reason=f"Skipping{env} because{reason}"))
9092
elifenv["MPLBACKEND"].startswith('wx')andsys.platform=='darwin':
9193
# ignore on OSX because that's currently broken (github #16849)
9294
marks.append(pytest.mark.xfail(reason='github #16849'))
@@ -97,15 +99,17 @@ def _get_testable_interactive_backends():
9799
):
98100
marks.append(# https://github.com/actions/setup-python/issues/649
99101
pytest.mark.xfail(reason='Tk version mismatch on Azure macOS CI'))
100-
envs.append(
101-
pytest.param(
102-
{**env,'BACKEND_DEPS':','.join(deps)},
103-
marks=marks,id=str(env)
104-
)
105-
)
102+
envs.append(({**env,'BACKEND_DEPS':','.join(deps)},marks))
106103
returnenvs
107104

108105

106+
def_get_testable_interactive_backends():
107+
# We re-create this because some of the callers below might modify the markers.
108+
return [pytest.param({**env},marks=[*marks],
109+
id='-'.join(f'{k}={v}'fork,vinenv.items()))
110+
forenv,marksin_get_available_interactive_backends()]
111+
112+
109113
defis_ci_environment():
110114
# Common CI variables
111115
ci_environment_variables= [

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp