Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fb8ae4

Browse files
authored
Merge pull request #13190 from timhoffm/test-returncode
Show returncode when subprocess test fails
2 parents 64eef6e + 240ea85 commit 9fb8ae4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

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)