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

Appearance settings

Commit 1326835

Browse filesBrowse files
committed
TST: move test that requires interactive backend to subprocess
1 parent 22b6e0d commit 1326835
Copy full SHA for 1326835

File tree

Expand file treeCollapse file tree

3 files changed

+32
-25
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-25
lines changed

‎lib/matplotlib/testing/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/__init__.py
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,24 @@ def ipython_in_subprocess(requested_backend_or_gui_framework, all_expected_backe
211211
)
212212

213213
assert proc.stdout.strip().endswith(f"'{expected_backend}'")
214+
215+
216+
def is_ci_environment():
217+
# Common CI variables
218+
ci_environment_variables = [
219+
'CI', # Generic CI environment variable
220+
'CONTINUOUS_INTEGRATION', # Generic CI environment variable
221+
'TRAVIS', # Travis CI
222+
'CIRCLECI', # CircleCI
223+
'JENKINS', # Jenkins
224+
'GITLAB_CI', # GitLab CI
225+
'GITHUB_ACTIONS', # GitHub Actions
226+
'TEAMCITY_VERSION' # TeamCity
227+
# Add other CI environment variables as needed
228+
]
229+
230+
for env_var in ci_environment_variables:
231+
if os.getenv(env_var):
232+
return True
233+
234+
return False

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
+1-22Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import matplotlib as mpl
2020
from matplotlib import _c_internal_utils
2121
from matplotlib.backend_tools import ToolToggleBase
22-
from matplotlib.testing import subprocess_run_helper as _run_helper
22+
from matplotlib.testing import subprocess_run_helper as _run_helper, is_ci_environment
2323

2424

2525
class _WaitForStringPopen(subprocess.Popen):
@@ -110,27 +110,6 @@ def _get_testable_interactive_backends():
110110
for env, marks in _get_available_interactive_backends()]
111111

112112

113-
def is_ci_environment():
114-
# Common CI variables
115-
ci_environment_variables = [
116-
'CI', # Generic CI environment variable
117-
'CONTINUOUS_INTEGRATION', # Generic CI environment variable
118-
'TRAVIS', # Travis CI
119-
'CIRCLECI', # CircleCI
120-
'JENKINS', # Jenkins
121-
'GITLAB_CI', # GitLab CI
122-
'GITHUB_ACTIONS', # GitHub Actions
123-
'TEAMCITY_VERSION' # TeamCity
124-
# Add other CI environment variables as needed
125-
]
126-
127-
for env_var in ci_environment_variables:
128-
if os.getenv(env_var):
129-
return True
130-
131-
return False
132-
133-
134113
# Reasonable safe values for slower CI/Remote and local architectures.
135114
_test_timeout = 120 if is_ci_environment() else 20
136115

‎lib/matplotlib/tests/test_pickle.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pickle.py
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import matplotlib as mpl
1010
from matplotlib import cm
11-
from matplotlib.testing import subprocess_run_helper
11+
from matplotlib.testing import subprocess_run_helper, is_ci_environment
1212
from matplotlib.testing.decorators import check_figures_equal
1313
from matplotlib.dates import rrulewrapper
1414
from matplotlib.lines import VertexSelector
@@ -311,7 +311,14 @@ def test_cycler():
311311

312312
# Run under an interactive backend to test that we don't try to pickle the
313313
# (interactive and non-picklable) canvas.
314-
@pytest.mark.backend('tkagg')
315-
def test_axeswidget_interactive():
314+
def _test_axeswidget_interactive():
316315
ax = plt.figure().add_subplot()
317316
pickle.dumps(mpl.widgets.Button(ax, "button"))
317+
318+
319+
def test_axeswidget_interactive():
320+
subprocess_run_helper(
321+
_test_axeswidget_interactive,
322+
timeout=120 if is_ci_environment() else 20,
323+
extra_env={'MPLBACKEND': 'tkagg'}
324+
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.