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

Commit389a7e8

Browse files
authored
Merge pull request#26680 from QuLogic/fix-ci-tests
Fix flaky CI tests
2 parents42336be +02263d2 commit389a7e8

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ def _test_figure_leak():
660660
reason="appveyor tests fail; gh-22988 suggests reworking")
661661
@pytest.mark.parametrize("env",_get_testable_interactive_backends())
662662
@pytest.mark.parametrize("time_mem", [(0.0,2_000_000), (0.1,30_000_000)])
663-
deftest_figure_leak_20490(env,time_mem):
663+
deftest_figure_leak_20490(env,time_mem,request):
664664
pytest.importorskip("psutil",reason="psutil needed to run this test")
665665

666666
# We haven't yet directly identified the leaks so test with a memory growth
@@ -669,9 +669,10 @@ def test_figure_leak_20490(env, time_mem):
669669
ifenv["MPLBACKEND"]=="wx":
670670
pytest.skip("wx backend is deprecated; tests failed on appveyor")
671671

672-
ifenv["MPLBACKEND"]=="macosx"or (
673-
env["MPLBACKEND"]=="tkagg"andsys.platform=='darwin'
674-
):
672+
ifenv["MPLBACKEND"]=="macosx":
673+
request.node.add_marker(pytest.mark.xfail(reason="macosx backend is leaky"))
674+
675+
ifenv["MPLBACKEND"]=="tkagg"andsys.platform=="darwin":
675676
acceptable_memory_leakage+=11_000_000
676677

677678
result=_run_helper(
@@ -815,12 +816,12 @@ def custom_signal_handler(signum, frame):
815816
('show', {'block':True}),
816817
('pause', {'interval':10})
817818
])
818-
deftest_other_signal_before_sigint(env,target,kwargs):
819+
deftest_other_signal_before_sigint(env,target,kwargs,request):
819820
backend=env.get("MPLBACKEND")
820821
ifnotbackend.startswith(("qt","macosx")):
821822
pytest.skip("SIGINT currently only tested on qt and macosx")
822-
ifbackend=="macosx"andtarget=="show":
823-
pytest.xfail("test currently failing formacosx+ show()")
823+
ifbackend=="macosx":
824+
request.node.add_marker(pytest.mark.xfail(reason="macosxbackend is buggy"))
824825
proc=_WaitForStringPopen(
825826
[sys.executable,"-c",
826827
inspect.getsource(_test_other_signal_before_sigint_impl)+

‎lib/matplotlib/tests/test_pickle.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_pickle_load_from_subprocess(fig_test, fig_ref, tmp_path):
143143
proc=subprocess_run_helper(
144144
_pickle_load_subprocess,
145145
timeout=60,
146-
extra_env={'PICKLE_FILE_PATH':str(fp)}
146+
extra_env={'PICKLE_FILE_PATH':str(fp),'MPLBACKEND':'Agg'}
147147
)
148148

149149
loaded_fig=pickle.loads(ast.literal_eval(proc.stdout))

‎lib/matplotlib/tests/test_ticker.py‎

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,22 +1640,36 @@ def test_latex(self, is_latex, usetex, expected):
16401640
assertfmt.format_pct(50,100)==expected
16411641

16421642

1643-
deftest_locale_comma():
1644-
currentLocale=locale.getlocale()
1643+
def_impl_locale_comma():
16451644
try:
16461645
locale.setlocale(locale.LC_ALL,'de_DE.UTF-8')
1647-
ticks=mticker.ScalarFormatter(useMathText=True,useLocale=True)
1648-
fmt='$\\mathdefault{%1.1f}$'
1649-
x=ticks._format_maybe_minus_and_locale(fmt,0.5)
1650-
assertx=='$\\mathdefault{0{,}5}$'
1651-
# Do not change , in the format string
1652-
fmt=',$\\mathdefault{,%1.1f},$'
1653-
x=ticks._format_maybe_minus_and_locale(fmt,0.5)
1654-
assertx==',$\\mathdefault{,0{,}5},$'
16551646
exceptlocale.Error:
1656-
pytest.skip("Locale de_DE.UTF-8 is not supported on this machine")
1657-
finally:
1658-
locale.setlocale(locale.LC_ALL,currentLocale)
1647+
print('SKIP: Locale de_DE.UTF-8 is not supported on this machine')
1648+
return
1649+
ticks=mticker.ScalarFormatter(useMathText=True,useLocale=True)
1650+
fmt='$\\mathdefault{%1.1f}$'
1651+
x=ticks._format_maybe_minus_and_locale(fmt,0.5)
1652+
assertx=='$\\mathdefault{0{,}5}$'
1653+
# Do not change , in the format string
1654+
fmt=',$\\mathdefault{,%1.1f},$'
1655+
x=ticks._format_maybe_minus_and_locale(fmt,0.5)
1656+
assertx==',$\\mathdefault{,0{,}5},$'
1657+
1658+
1659+
deftest_locale_comma():
1660+
# On some systems/pytest versions, `pytest.skip` in an exception handler
1661+
# does not skip, but is treated as an exception, so directly running this
1662+
# test can incorrectly fail instead of skip.
1663+
# Instead, run this test in a subprocess, which avoids the problem, and the
1664+
# need to fix the locale after.
1665+
proc=mpl.testing.subprocess_run_helper(_impl_locale_comma,timeout=60,
1666+
extra_env={'MPLBACKEND':'Agg'})
1667+
skip_msg=next((line[len('SKIP:'):].strip()
1668+
forlineinproc.stdout.splitlines()
1669+
ifline.startswith('SKIP:')),
1670+
'')
1671+
ifskip_msg:
1672+
pytest.skip(skip_msg)
16591673

16601674

16611675
deftest_majformatter_type():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp