Skip to content

Commit 7e305d9

Browse files
committed
Let sphinx tests print stdout/err.
1 parent 23e24d3 commit 7e305d9

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

lib/matplotlib/sphinxext/tests/test_tinypages.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import filecmp
44
from os.path import join as pjoin, dirname, isdir
55
import shutil
6-
from subprocess import call, Popen, PIPE
6+
import subprocess
77
import sys
88
import tempfile
99

@@ -19,11 +19,10 @@
1919
def setup_module():
2020
"""Check we have a recent enough version of sphinx installed.
2121
"""
22-
ret = call([sys.executable, '-msphinx', '--help'],
23-
stdout=PIPE, stderr=PIPE)
22+
args = [sys.executable, '-msphinx', '--help']
23+
ret = subprocess.call(args)
2424
if ret != 0:
25-
raise RuntimeError(
26-
"'{} -msphinx' does not return 0".format(sys.executable))
25+
raise RuntimeError("'{}' returned {}".format(' '.join(args), ret))
2726

2827

2928
@cbook.deprecated("2.1", alternative="filecmp.cmp")
@@ -45,16 +44,14 @@ def setup_class(cls):
4544
cls.html_dir = pjoin(cls.page_build, 'html')
4645
cls.doctree_dir = pjoin(cls.page_build, 'doctrees')
4746
# Build the pages with warnings turned into errors
48-
cmd = [sys.executable, '-msphinx', '-W', '-b', 'html',
49-
'-d', cls.doctree_dir,
50-
TINY_PAGES,
51-
cls.html_dir]
52-
proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
53-
out, err = proc.communicate()
54-
if proc.returncode != 0:
47+
args = [sys.executable, '-msphinx', '-W', '-b', 'html',
48+
'-d', cls.doctree_dir,
49+
TINY_PAGES,
50+
cls.html_dir]
51+
ret = subprocess.call([args])
52+
if ret != 0:
5553
raise RuntimeError(
56-
"'{} -msphinx' failed with stdout:\n{}\nstderr:\n{}\n"
57-
.format(sys.executable, out, err))
54+
"'{}' returned {}".format(' '.join(args), ret))
5855
except Exception as e:
5956
shutil.rmtree(cls.page_build)
6057
raise e

0 commit comments

Comments
 (0)