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

Skip to content

Commit 030943d

Browse files
Consistent subprocess error checks and add comments
1 parent 0ed7a30 commit 030943d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/matplotlib/tests/test_backend_tk.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def evil_blit(photoimage, aggimage, offsets, bboxptr):
5151
check=True,
5252
universal_newlines=True,
5353
)
54+
except subprocess.TimeoutExpired:
55+
pytest.fail("Subprocess timed out")
5456
except subprocess.CalledProcessError:
5557
pytest.fail("Likely regression on out-of-bounds data access"
5658
" in _tkagg.cpp")
@@ -95,6 +97,8 @@ def legitimate_quit():
9597
check=True,
9698
universal_newlines=True,
9799
)
100+
except subprocess.TimeoutExpired:
101+
pytest.fail("Subprocess timed out")
98102
except subprocess.CalledProcessError:
99103
pytest.fail("Subprocess failed to test intended behavior")
100104
else:
@@ -191,6 +195,7 @@ def test_never_update():
191195
assert "Exception in Tkinter callback" not in proc.stderr
192196
# make sure we can see other issues
193197
print(proc.stderr, file=sys.stderr)
198+
# Checking return code late so the Tkinter assertion happens first
194199
if proc.returncode:
195200
pytest.fail("Subprocess failed to test intended behavior")
196201

@@ -226,3 +231,7 @@ class Toolbar(NavigationToolbar2Tk):
226231
else:
227232
assert proc.stdout.count("setup complete") == 1
228233
assert proc.stdout.count("success") == 1
234+
# Checking return code late so the stdout assertions happen first
235+
if proc.returncode:
236+
pytest.fail("Subprocess failed to test intended behavior")
237+

0 commit comments

Comments
 (0)