Skip to content

Commit 130d752

Browse files
authored
Merge pull request #32198 from QuLogic/ci-timeout
TST: Set subprocess timeouts consistently on CI
2 parents a7db543 + e0a3d2e commit 130d752

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

lib/matplotlib/testing/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ def subprocess_run_helper(func, *args, timeout, extra_env=None):
143143
extra_env : dict[str, str]
144144
Any additional environment variables to be set for the subprocess.
145145
"""
146+
if is_ci_environment():
147+
timeout *= 6
146148
target = func.__name__
147149
module = func.__module__
148150
file = func.__code__.co_filename

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ def _get_testable_interactive_backends():
119119
for env, marks in _get_available_interactive_backends()]
120120

121121

122-
# Reasonable safe values for slower CI/Remote and local architectures.
123-
_test_timeout = 120 if is_ci_environment() else 20
122+
# Reasonable safe values for slower CI/Remote and local architectures; timeouts may be
123+
# automatically increased later by subprocess_run_helper.
124+
_test_timeout = 20
124125
_retry_count = 3 if is_ci_environment() else 0
125126

126127

lib/matplotlib/tests/test_getattr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import pytest
77

88
import matplotlib
9-
from matplotlib.testing import is_ci_environment, subprocess_run_helper
9+
from matplotlib.testing import subprocess_run_helper
10+
1011

1112
# Get the names of all matplotlib submodules,
1213
# except for the unit tests and private modules.
@@ -59,8 +60,7 @@ def _test_module_getattr():
5960

6061
@pytest.mark.parametrize('module_name', backend_module_names)
6162
def test_backend_getattr(module_name):
62-
proc = subprocess_run_helper(_test_module_getattr, module_name,
63-
timeout=120 if is_ci_environment() else 20)
63+
proc = subprocess_run_helper(_test_module_getattr, module_name, timeout=20)
6464
if 'SKIP: ' in proc.stdout:
6565
pytest.skip(proc.stdout.removeprefix('SKIP: '))
6666
print(proc.stdout)

lib/matplotlib/tests/test_pickle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import matplotlib as mpl
1111
from matplotlib import cm
12-
from matplotlib.testing import subprocess_run_helper, is_ci_environment
12+
from matplotlib.testing import subprocess_run_helper
1313
from matplotlib.testing.decorators import check_figures_equal
1414
from matplotlib.dates import rrulewrapper # type: ignore[attr-defined]
1515
from matplotlib.lines import VertexSelector
@@ -319,6 +319,6 @@ def _test_axeswidget_interactive():
319319
def test_axeswidget_interactive():
320320
subprocess_run_helper(
321321
_test_axeswidget_interactive,
322-
timeout=120 if is_ci_environment() else 20,
322+
timeout=20,
323323
extra_env={'MPLBACKEND': 'tkagg'}
324324
)

0 commit comments

Comments
 (0)