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

Commit40f20c3

Browse files
committed
FIX: Move all tests using subprocess to the same worker on windows
This is a somewhat wild guess based on#29797 (comment)> which makes me think we are somehow crossing state what launching the subprocesses.Using the `xdist_group` with `--dist=loadgroup` should put all tests ofthat group to the same worker according tohttps://pytest-xdist.readthedocs.io/en/stable/distribution.html.I've only added `--dist=loadgroup` to the windows pipelines, so tests on other systems are not affected at all.The first test is to see whether this works in the PR. - But to be sure,it think we would need to put this on master and monitor whether thetimeouts disappear.
1 parent919d9e9 commit40f20c3

17 files changed

+34
-0
lines changed

‎azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ stages:
149149
150150
PYTHONFAULTHANDLER=1 pytest -rfEsXR -n 2 \
151151
--maxfail=50 --timeout=300 --durations=25 \
152+
--dist=loadgroup \
152153
--junitxml=junit/test-results.xml --cov-report=xml --cov=lib
153154
154155
if [[ $VS_VER == 2022 ]]; then

‎lib/matplotlib/tests/test_backend_inline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
pytest.importorskip('matplotlib_inline')
1313

1414

15+
@pytest.mark.xdist_group(name="subprocess")
1516
deftest_ipynb():
1617
nb_path=Path(__file__).parent/'test_inline_01.ipynb'
1718

‎lib/matplotlib/tests/test_backend_macosx.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def _test_cached_renderer():
2525

2626

2727
@pytest.mark.backend('macosx',skip_on_importerror=True)
28+
@pytest.mark.xdist_group(name="subprocess")
2829
deftest_cached_renderer():
2930
subprocess_run_helper(_test_cached_renderer,timeout=_test_timeout,
3031
extra_env={"MPLBACKEND":"macosx"})
@@ -55,13 +56,15 @@ def new_choose_save_file(title, directory, filename):
5556

5657

5758
@pytest.mark.backend('macosx',skip_on_importerror=True)
59+
@pytest.mark.xdist_group(name="subprocess")
5860
deftest_savefig_rcparam(tmp_path):
5961
subprocess_run_helper(
6062
_test_savefig_rcparam,timeout=_test_timeout,
6163
extra_env={"MPLBACKEND":"macosx","TEST_SAVEFIG_PATH":tmp_path})
6264

6365

6466
@pytest.mark.backend('macosx',skip_on_importerror=True)
67+
@pytest.mark.xdist_group(name="subprocess")
6568
deftest_ipython():
6669
frommatplotlib.testingimportipython_in_subprocess
6770
ipython_in_subprocess("osx", {(8,24):"macosx", (7,0):"MacOSX"})
@@ -81,6 +84,7 @@ def _test_save_figure_return():
8184

8285

8386
@pytest.mark.backend('macosx',skip_on_importerror=True)
87+
@pytest.mark.xdist_group(name="subprocess")
8488
deftest_save_figure_return():
8589
subprocess_run_helper(_test_save_figure_return,timeout=_test_timeout,
8690
extra_env={"MPLBACKEND":"macosx"})

‎lib/matplotlib/tests/test_backend_nbagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# From https://blog.thedataincubator.com/2016/06/testing-jupyter-notebooks/
1414

1515

16+
@pytest.mark.xdist_group(name="subprocess")
1617
deftest_ipynb():
1718
nb_path=Path(__file__).parent/'test_nbagg_01.ipynb'
1819

‎lib/matplotlib/tests/test_backend_tk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def _isolated_tk_test(success_count, func=None):
4343
sys.platform=='darwin'andsys.version_info[:2]< (3,11),
4444
reason='Tk version mismatch on Azure macOS CI'
4545
)
46+
@pytest.mark.xdist_group(name="subprocess")
4647
@functools.wraps(func)
4748
deftest_func():
4849
# even if the package exists, may not actually be importable this can

‎lib/matplotlib/tests/test_backend_webagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
@pytest.mark.parametrize("backend", ["webagg","nbagg"])
10+
@pytest.mark.xdist_group(name="subprocess")
1011
deftest_webagg_fallback(backend):
1112
pytest.importorskip("tornado")
1213
ifbackend=="nbagg":

‎lib/matplotlib/tests/test_basic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
importsys
44
importtextwrap
55

6+
importpytest
7+
68
frommatplotlib.testingimportsubprocess_run_for_testing
79

810

@@ -28,6 +30,7 @@ def test_override_builtins():
2830
assertoverridden<=ok_to_override
2931

3032

33+
@pytest.mark.xdist_group(name="subprocess")
3134
deftest_lazy_imports():
3235
source=textwrap.dedent("""
3336
import sys

‎lib/matplotlib/tests/test_determinism.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def draw(self, renderer=None):
154154
pytest.param("mhip","svg",True,marks=needs_usetex),
155155
]
156156
)
157+
@pytest.mark.xdist_group(name="subprocess")
157158
deftest_determinism_check(objects,fmt,usetex):
158159
"""
159160
Output three times the same graphs and checks that the outputs are exactly
@@ -195,6 +196,7 @@ def test_determinism_check(objects, fmt, usetex):
195196
("ps",b"%%CreationDate: Sat Jan 01 00:00:00 2000"),
196197
]
197198
)
199+
@pytest.mark.xdist_group(name="subprocess")
198200
deftest_determinism_source_date_epoch(fmt,string):
199201
"""
200202
Test SOURCE_DATE_EPOCH support. Output a document with the environment

‎lib/matplotlib/tests/test_font_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,14 @@ def bad_idea(n):
282282
raiseRuntimeError("thread failed to join")
283283

284284

285+
@pytest.mark.xdist_group(name="subprocess")
285286
deftest_fontcache_thread_safe():
286287
pytest.importorskip('threading')
287288

288289
subprocess_run_helper(_test_threading,timeout=10)
289290

290291

292+
@pytest.mark.xdist_group(name="subprocess")
291293
deftest_lockfilefailure(tmp_path):
292294
# The logic here:
293295
# 1. get a temp directory from pytest

‎lib/matplotlib/tests/test_matplotlib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_parse_to_version_info(version_str, version_tuple):
2222
reason="chmod() doesn't work as is on Windows")
2323
@pytest.mark.skipif(sys.platform!="win32"andos.geteuid()==0,
2424
reason="chmod() doesn't work as root")
25+
@pytest.mark.xdist_group(name="subprocess")
2526
deftest_tmpconfigdir_warning(tmp_path):
2627
"""Test that a warning is emitted if a temporary configdir must be used."""
2728
mode=os.stat(tmp_path).st_mode
@@ -36,6 +37,7 @@ def test_tmpconfigdir_warning(tmp_path):
3637
os.chmod(tmp_path,mode)
3738

3839

40+
@pytest.mark.xdist_group(name="subprocess")
3941
deftest_importable_with_no_home(tmp_path):
4042
subprocess_run_for_testing(
4143
[sys.executable,"-c",
@@ -65,6 +67,7 @@ def parse(key):
6567
set(backend_registry.list_builtin(BackendFilter.NON_INTERACTIVE)))
6668

6769

70+
@pytest.mark.xdist_group(name="subprocess")
6871
deftest_importable_with__OO():
6972
"""
7073
When using -OO or export PYTHONOPTIMIZE=2, docstrings are discarded,

‎lib/matplotlib/tests/test_pickle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def _pickle_load_subprocess():
136136

137137

138138
@mpl.style.context("default")
139+
@pytest.mark.xdist_group(name="subprocess")
139140
@check_figures_equal()
140141
deftest_pickle_load_from_subprocess(fig_test,fig_ref,tmp_path):
141142
_generate_complete_test_figure(fig_ref)
@@ -331,6 +332,7 @@ def _test_axeswidget_interactive():
331332
sys.platform=='darwin'andsys.version_info[:2]< (3,11),
332333
reason='Tk version mismatch on Azure macOS CI'
333334
)
335+
@pytest.mark.xdist_group(name="subprocess")
334336
deftest_axeswidget_interactive():
335337
subprocess_run_helper(
336338
_test_axeswidget_interactive,

‎lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def funcy(ax, x, y, z, t=None):
245245
funcy.__doc__)
246246

247247

248+
@pytest.mark.xdist_group(name="subprocess")
248249
deftest_data_parameter_replacement():
249250
"""
250251
Test that the docstring contains the correct *data* parameter stub

‎lib/matplotlib/tests/test_pyplot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
frommatplotlibimportpyplotasplt
1212

1313

14+
@pytest.mark.xdist_group(name="subprocess")
1415
deftest_pyplot_up_to_date(tmp_path):
1516
pytest.importorskip("black")
1617

@@ -348,6 +349,7 @@ def test_set_current_axes_on_subfigure():
348349
assertplt.gca()==ax
349350

350351

352+
@pytest.mark.xdist_group(name="subprocess")
351353
deftest_pylab_integration():
352354
IPython=pytest.importorskip("IPython")
353355
mpl.testing.subprocess_run_helper(

‎lib/matplotlib/tests/test_rcparams.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ def test_rcparams_reset_after_fail():
529529

530530

531531
@pytest.mark.skipif(sys.platform!="linux",reason="Linux only")
532+
@pytest.mark.xdist_group(name="subprocess")
532533
deftest_backend_fallback_headless_invalid_backend(tmp_path):
533534
env= {**os.environ,
534535
"DISPLAY":"","WAYLAND_DISPLAY":"",
@@ -546,6 +547,7 @@ def test_backend_fallback_headless_invalid_backend(tmp_path):
546547

547548

548549
@pytest.mark.skipif(sys.platform!="linux",reason="Linux only")
550+
@pytest.mark.xdist_group(name="subprocess")
549551
deftest_backend_fallback_headless_auto_backend(tmp_path):
550552
# specify a headless mpl environment, but request a graphical (tk) backend
551553
env= {**os.environ,
@@ -570,6 +572,7 @@ def test_backend_fallback_headless_auto_backend(tmp_path):
570572
@pytest.mark.skipif(
571573
sys.platform=="linux"andnot_c_internal_utils.xdisplay_is_valid(),
572574
reason="headless")
575+
@pytest.mark.xdist_group(name="subprocess")
573576
deftest_backend_fallback_headful(tmp_path):
574577
ifparse_version(pytest.__version__)>=parse_version('8.2.0'):
575578
pytest_kwargs=dict(exc_type=ImportError)

‎lib/matplotlib/tests/test_sphinxext.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
3232
asserthtml_dir.is_dir()
3333

3434

35+
@pytest.mark.xdist_group(name="subprocess")
3536
deftest_tinypages(tmp_path):
3637
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
3738
dirs_exist_ok=True)
@@ -124,6 +125,7 @@ def plot_directive_file(num):
124125
assertfilecmp.cmp(range_6,plot_file(5))
125126

126127

128+
@pytest.mark.xdist_group(name="subprocess")
127129
deftest_plot_html_show_source_link(tmp_path):
128130
parent=Path(__file__).parent
129131
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
@@ -147,6 +149,7 @@ def test_plot_html_show_source_link(tmp_path):
147149

148150

149151
@pytest.mark.parametrize('plot_html_show_source_link', [0,1])
152+
@pytest.mark.xdist_group(name="subprocess")
150153
deftest_show_source_link_true(tmp_path,plot_html_show_source_link):
151154
# Test that a source link is generated if :show-source-link: is true,
152155
# whether or not plot_html_show_source_link is true.
@@ -167,6 +170,7 @@ def test_show_source_link_true(tmp_path, plot_html_show_source_link):
167170

168171

169172
@pytest.mark.parametrize('plot_html_show_source_link', [0,1])
173+
@pytest.mark.xdist_group(name="subprocess")
170174
deftest_show_source_link_false(tmp_path,plot_html_show_source_link):
171175
# Test that a source link is NOT generated if :show-source-link: is false,
172176
# whether or not plot_html_show_source_link is true.
@@ -186,6 +190,7 @@ def test_show_source_link_false(tmp_path, plot_html_show_source_link):
186190
assertlen(list(html_dir.glob("**/index-1.py")))==0
187191

188192

193+
@pytest.mark.xdist_group(name="subprocess")
189194
deftest_srcset_version(tmp_path):
190195
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
191196
dirs_exist_ok=True)

‎lib/matplotlib/tests/test_texmanager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_unicode_characters():
6464

6565

6666
@needs_usetex
67+
@pytest.mark.xdist_group(name="subprocess")
6768
deftest_openin_any_paranoid():
6869
completed=subprocess_run_for_testing(
6970
[sys.executable,"-c",

‎lib/matplotlib/tests/test_ticker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,7 @@ def _impl_locale_comma():
17661766
assertx=='0,5'
17671767

17681768

1769+
@pytest.mark.xdist_group(name="subprocess")
17691770
deftest_locale_comma():
17701771
# On some systems/pytest versions, `pytest.skip` in an exception handler
17711772
# does not skip, but is treated as an exception, so directly running this

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp