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

FIX: Move all tests using subprocess to the same worker on windows#29981

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

Closed
timhoffm wants to merge5 commits intomatplotlib:mainfromtimhoffm:fix-timeout
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletionazure-pipelines.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -147,8 +147,13 @@ stages:
fi
echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL"

if [[ $(python.version) == 3.11 ]]; then
# when removing this, also remove
# @pytest.mark.xdist_group(name="subprocess") from tests
DIST_LOAD_GROUP=--dist=loadgroup
fi
PYTHONFAULTHANDLER=1 pytest -rfEsXR -n 2 \
--maxfail=50 --timeout=300 --durations=25 \
--maxfail=50 --timeout=300 --durations=25$DIST_LOAD_GROUP\
--junitxml=junit/test-results.xml --cov-report=xml --cov=lib

if [[ $VS_VER == 2022 ]]; then
Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/tests/test_backend_inline.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,6 +12,7 @@
pytest.importorskip('matplotlib_inline')


@pytest.mark.xdist_group(name="subprocess")
def test_ipynb():
nb_path = Path(__file__).parent / 'test_inline_01.ipynb'

Expand Down
4 changes: 4 additions & 0 deletionslib/matplotlib/tests/test_backend_macosx.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ def _test_cached_renderer():


@pytest.mark.backend('macosx', skip_on_importerror=True)
@pytest.mark.xdist_group(name="subprocess")
def test_cached_renderer():
subprocess_run_helper(_test_cached_renderer, timeout=_test_timeout,
extra_env={"MPLBACKEND": "macosx"})
Expand DownExpand Up@@ -55,13 +56,15 @@ def new_choose_save_file(title, directory, filename):


@pytest.mark.backend('macosx', skip_on_importerror=True)
@pytest.mark.xdist_group(name="subprocess")
def test_savefig_rcparam(tmp_path):
subprocess_run_helper(
_test_savefig_rcparam, timeout=_test_timeout,
extra_env={"MPLBACKEND": "macosx", "TEST_SAVEFIG_PATH": tmp_path})


@pytest.mark.backend('macosx', skip_on_importerror=True)
@pytest.mark.xdist_group(name="subprocess")
def test_ipython():
from matplotlib.testing import ipython_in_subprocess
ipython_in_subprocess("osx", {(8, 24): "macosx", (7, 0): "MacOSX"})
Expand All@@ -81,6 +84,7 @@ def _test_save_figure_return():


@pytest.mark.backend('macosx', skip_on_importerror=True)
@pytest.mark.xdist_group(name="subprocess")
def test_save_figure_return():
subprocess_run_helper(_test_save_figure_return, timeout=_test_timeout,
extra_env={"MPLBACKEND": "macosx"})
1 change: 1 addition & 0 deletionslib/matplotlib/tests/test_backend_nbagg.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
# From https://blog.thedataincubator.com/2016/06/testing-jupyter-notebooks/


@pytest.mark.xdist_group(name="subprocess")
def test_ipynb():
nb_path = Path(__file__).parent / 'test_nbagg_01.ipynb'

Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/tests/test_backend_tk.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,6 +43,7 @@ def _isolated_tk_test(success_count, func=None):
sys.platform == 'darwin' and sys.version_info[:2] < (3, 11),
reason='Tk version mismatch on Azure macOS CI'
)
@pytest.mark.xdist_group(name="subprocess")
@functools.wraps(func)
def test_func():
# even if the package exists, may not actually be importable this can
Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/tests/test_backend_webagg.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@


@pytest.mark.parametrize("backend", ["webagg", "nbagg"])
@pytest.mark.xdist_group(name="subprocess")
def test_webagg_fallback(backend):
pytest.importorskip("tornado")
if backend == "nbagg":
Expand Down
10 changes: 10 additions & 0 deletionslib/matplotlib/tests/test_backends_interactive.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -238,6 +238,7 @@ def check_alt_backend(alt_backend):
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
@pytest.mark.parametrize("toolbar", ["toolbar2", "toolmanager"])
@pytest.mark.flaky(reruns=3)
@pytest.mark.xdist_group(name="subprocess")
def test_interactive_backend(env, toolbar):
if env["MPLBACKEND"] == "macosx":
if toolbar == "toolmanager":
Expand DownExpand Up@@ -330,6 +331,7 @@ def _test_thread_impl():

@pytest.mark.parametrize("env", _thread_safe_backends)
@pytest.mark.flaky(reruns=3)
@pytest.mark.xdist_group(name="subprocess")
def test_interactive_thread_safety(env):
proc = _run_helper(_test_thread_impl, timeout=_test_timeout, extra_env=env)
assert proc.stdout.count("CloseEvent") == 1
Expand All@@ -349,6 +351,7 @@ def _impl_test_lazy_auto_backend_selection():
assert isinstance(bk, str)


@pytest.mark.xdist_group(name="subprocess")
def test_lazy_auto_backend_selection():
_run_helper(_impl_test_lazy_auto_backend_selection,
timeout=_test_timeout)
Expand DownExpand Up@@ -381,6 +384,7 @@ def _implcore():
assert 'PyQt5' in sys.modules or 'pyside2' in sys.modules


@pytest.mark.xdist_group(name="subprocess")
def test_qt5backends_uses_qt5():
qt5_bindings = [
dep for dep in ['PyQt5', 'pyside2']
Expand DownExpand Up@@ -414,6 +418,7 @@ def _impl_missing():
plt.switch_backend("qt5agg")


@pytest.mark.xdist_group(name="subprocess")
def test_qt_missing():
_run_helper(_impl_missing, timeout=_test_timeout)

Expand DownExpand Up@@ -459,6 +464,7 @@ def qt5_and_qt6_pairs():
sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
reason="$DISPLAY and $WAYLAND_DISPLAY are unset")
@pytest.mark.parametrize('host, mpl', [*qt5_and_qt6_pairs()])
@pytest.mark.xdist_group(name="subprocess")
def test_cross_Qt_imports(host, mpl):
try:
proc = _run_helper(_impl_test_cross_Qt_imports, host, mpl,
Expand DownExpand Up@@ -541,6 +547,7 @@ def _lazy_headless():

@pytest.mark.skipif(sys.platform != "linux", reason="this a linux-only test")
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
@pytest.mark.xdist_group(name="subprocess")
def test_lazy_linux_headless(env):
proc = _run_helper(
_lazy_headless,
Expand DownExpand Up@@ -618,6 +625,7 @@ def _test_number_of_draws_script():
@pytest.mark.parametrize("env", _blit_backends)
# subprocesses can struggle to get the display, so rerun a few times
@pytest.mark.flaky(reruns=4)
@pytest.mark.xdist_group(name="subprocess")
def test_blitting_events(env):
proc = _run_helper(
_test_number_of_draws_script, timeout=_test_timeout, extra_env=env)
Expand All@@ -636,6 +644,7 @@ def _fallback_check():
matplotlib.pyplot.figure()


@pytest.mark.xdist_group(name="subprocess")
def test_fallback_to_different_backend():
pytest.importorskip("IPython")
# Runs the process that caused the GH issue 23770
Expand DownExpand Up@@ -680,6 +689,7 @@ def _impl_test_interactive_timers():


@pytest.mark.parametrize("env", _get_testable_interactive_backends())
@pytest.mark.xdist_group(name="subprocess")
def test_interactive_timers(env):
if env["MPLBACKEND"] == "gtk3cairo" and os.getenv("CI"):
pytest.skip("gtk3cairo timers do not work in remote CI")
Expand Down
3 changes: 3 additions & 0 deletionslib/matplotlib/tests/test_basic.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,8 @@
import sys
import textwrap

import pytest

from matplotlib.testing import subprocess_run_for_testing


Expand All@@ -28,6 +30,7 @@ def test_override_builtins():
assert overridden <= ok_to_override


@pytest.mark.xdist_group(name="subprocess")
def test_lazy_imports():
source = textwrap.dedent("""
import sys
Expand Down
2 changes: 2 additions & 0 deletionslib/matplotlib/tests/test_determinism.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,6 +154,7 @@ def draw(self, renderer=None):
pytest.param("mhip", "svg", True, marks=needs_usetex),
]
)
@pytest.mark.xdist_group(name="subprocess")
def test_determinism_check(objects, fmt, usetex):
"""
Output three times the same graphs and checks that the outputs are exactly
Expand DownExpand Up@@ -195,6 +196,7 @@ def test_determinism_check(objects, fmt, usetex):
("ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000"),
]
)
@pytest.mark.xdist_group(name="subprocess")
def test_determinism_source_date_epoch(fmt, string):
"""
Test SOURCE_DATE_EPOCH support. Output a document with the environment
Expand Down
2 changes: 2 additions & 0 deletionslib/matplotlib/tests/test_font_manager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -282,12 +282,14 @@ def bad_idea(n):
raise RuntimeError("thread failed to join")


@pytest.mark.xdist_group(name="subprocess")
def test_fontcache_thread_safe():
pytest.importorskip('threading')

subprocess_run_helper(_test_threading, timeout=10)


@pytest.mark.xdist_group(name="subprocess")
def test_lockfilefailure(tmp_path):
# The logic here:
# 1. get a temp directory from pytest
Expand Down
3 changes: 3 additions & 0 deletionslib/matplotlib/tests/test_matplotlib.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,6 +22,7 @@ def test_parse_to_version_info(version_str, version_tuple):
reason="chmod() doesn't work as is on Windows")
@pytest.mark.skipif(sys.platform != "win32" and os.geteuid() == 0,
reason="chmod() doesn't work as root")
@pytest.mark.xdist_group(name="subprocess")
def test_tmpconfigdir_warning(tmp_path):
"""Test that a warning is emitted if a temporary configdir must be used."""
mode = os.stat(tmp_path).st_mode
Expand All@@ -36,6 +37,7 @@ def test_tmpconfigdir_warning(tmp_path):
os.chmod(tmp_path, mode)


@pytest.mark.xdist_group(name="subprocess")
def test_importable_with_no_home(tmp_path):
subprocess_run_for_testing(
[sys.executable, "-c",
Expand DownExpand Up@@ -65,6 +67,7 @@ def parse(key):
set(backend_registry.list_builtin(BackendFilter.NON_INTERACTIVE)))


@pytest.mark.xdist_group(name="subprocess")
def test_importable_with__OO():
"""
When using -OO or export PYTHONOPTIMIZE=2, docstrings are discarded,
Expand Down
39 changes: 13 additions & 26 deletionslib/matplotlib/tests/test_patches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -825,8 +825,9 @@ def test_annulus():
ax.set_aspect('equal')


@pytest.mark.parametrize('mode', ('by_semiaxis', 'by_radius'))
@image_comparison(baseline_images=['annulus'], extensions=['png'])
def test_annulus_setters():
def test_annulus_setters(mode):

fig, ax = plt.subplots()
cir = Annulus((0., 0.), 0.2, 0.01, fc='g') # circular annulus
Expand All@@ -837,37 +838,23 @@ def test_annulus_setters():
ax.set_aspect('equal')

cir.center = (0.5, 0.5)
cir.radii = 0.2
cir.width = 0.05

ell.center = (0.5, 0.5)
ell.radii = (0.5, 0.3)
ell.width = 0.1
ell.angle = 45

if mode == 'by_semiaxis':
cir.set_semimajor(0.2)
cir.set_semiminor(0.2)
assert cir.radii == (0.2, 0.2)

@image_comparison(baseline_images=['annulus'], extensions=['png'])
def test_annulus_setters2():
ell.set_semimajor(0.5)
ell.set_semiminor(0.3)
assert ell.radii == (0.5, 0.3)
elif mode == 'by_radius':
cir.radii = 0.2
ell.radii = (0.5, 0.3)

fig, ax = plt.subplots()
cir = Annulus((0., 0.), 0.2, 0.01, fc='g') # circular annulus
ell = Annulus((0., 0.), (1, 2), 0.1, 0, # elliptical
fc='m', ec='b', alpha=0.5, hatch='xxx')
ax.add_patch(cir)
ax.add_patch(ell)
ax.set_aspect('equal')

cir.center = (0.5, 0.5)
cir.set_semimajor(0.2)
cir.set_semiminor(0.2)
assert cir.radii == (0.2, 0.2)
cir.width = 0.05

ell.center = (0.5, 0.5)
ell.set_semimajor(0.5)
ell.set_semiminor(0.3)
assert ell.radii == (0.5, 0.3)
ell.width = 0.1

ell.angle = 45


Expand Down
2 changes: 2 additions & 0 deletionslib/matplotlib/tests/test_pickle.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,6 +136,7 @@ def _pickle_load_subprocess():


@mpl.style.context("default")
@pytest.mark.xdist_group(name="subprocess")
@check_figures_equal()
def test_pickle_load_from_subprocess(fig_test, fig_ref, tmp_path):
_generate_complete_test_figure(fig_ref)
Expand DownExpand Up@@ -331,6 +332,7 @@ def _test_axeswidget_interactive():
sys.platform == 'darwin' and sys.version_info[:2] < (3, 11),
reason='Tk version mismatch on Azure macOS CI'
)
@pytest.mark.xdist_group(name="subprocess")
def test_axeswidget_interactive():
subprocess_run_helper(
_test_axeswidget_interactive,
Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/tests/test_preprocess_data.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -245,6 +245,7 @@ def funcy(ax, x, y, z, t=None):
funcy.__doc__)


@pytest.mark.xdist_group(name="subprocess")
def test_data_parameter_replacement():
"""
Test that the docstring contains the correct *data* parameter stub
Expand Down
2 changes: 2 additions & 0 deletionslib/matplotlib/tests/test_pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@
from matplotlib import pyplot as plt


@pytest.mark.xdist_group(name="subprocess")
def test_pyplot_up_to_date(tmp_path):
pytest.importorskip("black")

Expand DownExpand Up@@ -348,6 +349,7 @@ def test_set_current_axes_on_subfigure():
assert plt.gca() == ax


@pytest.mark.xdist_group(name="subprocess")
def test_pylab_integration():
IPython = pytest.importorskip("IPython")
mpl.testing.subprocess_run_helper(
Expand Down
3 changes: 3 additions & 0 deletionslib/matplotlib/tests/test_rcparams.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -529,6 +529,7 @@ def test_rcparams_reset_after_fail():


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


@pytest.mark.skipif(sys.platform != "linux", reason="Linux only")
@pytest.mark.xdist_group(name="subprocess")
def test_backend_fallback_headless_auto_backend(tmp_path):
# specify a headless mpl environment, but request a graphical (tk) backend
env = {**os.environ,
Expand All@@ -570,6 +572,7 @@ def test_backend_fallback_headless_auto_backend(tmp_path):
@pytest.mark.skipif(
sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(),
reason="headless")
@pytest.mark.xdist_group(name="subprocess")
def test_backend_fallback_headful(tmp_path):
if parse_version(pytest.__version__) >= parse_version('8.2.0'):
pytest_kwargs = dict(exc_type=ImportError)
Expand Down
5 changes: 5 additions & 0 deletionslib/matplotlib/tests/test_sphinxext.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
assert html_dir.is_dir()


@pytest.mark.xdist_group(name="subprocess")
def test_tinypages(tmp_path):
shutil.copytree(Path(__file__).parent / 'tinypages', tmp_path,
dirs_exist_ok=True)
Expand DownExpand Up@@ -124,6 +125,7 @@ def plot_directive_file(num):
assert filecmp.cmp(range_6, plot_file(5))


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


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


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


@pytest.mark.xdist_group(name="subprocess")
def test_srcset_version(tmp_path):
shutil.copytree(Path(__file__).parent / 'tinypages', tmp_path,
dirs_exist_ok=True)
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp