Skip to content

Commit 240ea85

Browse files
committed
Show returncode when subprocess test fails
1 parent 64eef6e commit 240ea85

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ def check_alt_backend(alt_backend):
110110
@pytest.mark.parametrize("backend", _get_testable_interactive_backends())
111111
@pytest.mark.flaky(reruns=3)
112112
def test_interactive_backend(backend):
113-
if subprocess.run([sys.executable, "-c", _test_script],
114-
env={**os.environ, "MPLBACKEND": backend},
115-
timeout=_test_timeout).returncode:
116-
pytest.fail("The subprocess returned an error.")
113+
proc = subprocess.run([sys.executable, "-c", _test_script],
114+
env={**os.environ, "MPLBACKEND": backend},
115+
timeout=_test_timeout)
116+
if proc.returncode:
117+
pytest.fail("The subprocess returned with non-zero exit status "
118+
f"{proc.returncode}.")
117119

118120

119121
@pytest.mark.skipif('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI' in os.environ,

0 commit comments

Comments
 (0)