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 db71b51

Browse filesBrowse files
committed
TST: Catch fork failures and mark them as xfail instead of fail.
Not a pass, but not the fault of the test. TST,BUG: Move pytest import to just before its use. Hopefully this fixes the doc builds. TST: Cygwin: Mark more fork failures as xfail. Not a pass, but not matplotlib's fault.
1 parent 302aca2 commit db71b51
Copy full SHA for db71b51

File tree

Expand file treeCollapse file tree

4 files changed

+48
-18
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+48
-18
lines changed

‎lib/matplotlib/testing/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/__init__.py
+17-10Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,23 @@ def subprocess_run_helper(func, *args, timeout, extra_env=None):
6666
"""
6767
target = func.__name__
6868
module = func.__module__
69-
proc = subprocess.run(
70-
[sys.executable,
71-
"-c",
72-
f"from {module} import {target}; {target}()",
73-
*args],
74-
env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
75-
timeout=timeout, check=True,
76-
stdout=subprocess.PIPE,
77-
stderr=subprocess.PIPE,
78-
universal_newlines=True)
69+
try:
70+
proc = subprocess.run(
71+
[sys.executable,
72+
"-c",
73+
f"from {module} import {target}; {target}()",
74+
*args],
75+
env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
76+
timeout=timeout, check=True,
77+
stdout=subprocess.PIPE,
78+
stderr=subprocess.PIPE,
79+
universal_newlines=True)
80+
except BlockingIOError:
81+
if sys.platform == "cygwin":
82+
import pytest
83+
pytest.xfail("Fork failure")
84+
else:
85+
raise
7986
return proc
8087

8188

‎lib/matplotlib/tests/test_preprocess_data.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_preprocess_data.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ def test_data_parameter_replacement():
259259
"import matplotlib.pyplot as plt"
260260
)
261261
cmd = [sys.executable, "-c", program]
262-
completed_proc = subprocess.run(cmd, text=True, capture_output=True)
262+
try:
263+
completed_proc = subprocess.run(cmd, text=True, capture_output=True)
264+
except BlockingIOError:
265+
if sys.platform == "cygwin":
266+
pytest.xfail("Fork failure")
267+
raise
263268
assert 'data parameter docstring error' not in completed_proc.stderr
264269

265270

‎lib/matplotlib/tests/test_pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pyplot.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ def test_pyplot_up_to_date(tmpdir):
2020
plt_file = tmpdir.join('pyplot.py')
2121
plt_file.write_text(orig_contents, 'utf-8')
2222

23-
subprocess.run([sys.executable, str(gen_script), str(plt_file)],
24-
check=True)
23+
try:
24+
subprocess.run([sys.executable, str(gen_script), str(plt_file)],
25+
check=True)
26+
except BlockingIOError:
27+
if sys.platform == "cygwin":
28+
pytest.xfail("Fork failure")
29+
raise
2530
new_contents = plt_file.read_text('utf-8')
2631

2732
if orig_contents != new_contents:

‎lib/matplotlib/tests/test_sphinxext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_sphinxext.py
+18-5Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
1919
extra_args = [] if extra_args is None else extra_args
2020
cmd = [sys.executable, '-msphinx', '-W', '-b', 'html',
2121
'-d', str(doctree_dir), str(source_dir), str(html_dir), *extra_args]
22-
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True,
23-
env={**os.environ, "MPLBACKEND": ""})
22+
try:
23+
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True,
24+
env={**os.environ, "MPLBACKEND": ""})
25+
except BlockingIOError:
26+
if sys.platform == "cygwin":
27+
pytest.xfail("Fork failure")
28+
else:
29+
raise
2430
out, err = proc.communicate()
2531

2632
assert proc.returncode == 0, \
@@ -44,9 +50,16 @@ def test_tinypages(tmp_path):
4450
# On CI, gcov emits warnings (due to agg headers being included with the
4551
# same name in multiple extension modules -- but we don't care about their
4652
# coverage anyways); hide them using GCOV_ERROR_FILE.
47-
proc = Popen(
48-
cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True,
49-
env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull})
53+
try:
54+
proc = Popen(
55+
cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True,
56+
env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull}
57+
)
58+
except BlockingIOError:
59+
if sys.platform == "cygwin":
60+
pytest.xfail("Fork failure")
61+
else:
62+
raise
5063
out, err = proc.communicate()
5164

5265
# Build the pages with warnings turned into errors

0 commit comments

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