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

Skip to content

Commit 0d465ac

Browse files
committed
TST: be explicit in test_backend_ps
Random thrashing to prevent the intermittent failures
1 parent 621b98c commit 0d465ac

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@
2424

2525

2626
def _test_savefig_to_stringio(format='ps', use_log=False):
27+
fig, ax = plt.subplots()
2728
buffers = [
2829
six.moves.StringIO(),
2930
io.StringIO(),
3031
io.BytesIO()]
3132

32-
plt.figure()
33-
3433
if use_log:
35-
plt.yscale('log')
34+
ax.set_yscale('log')
3635

37-
plt.plot([1, 2], [1, 2])
38-
plt.title("Déjà vu")
36+
ax.plot([1, 2], [1, 2])
37+
ax.set_title("Déjà vu")
3938
for buffer in buffers:
40-
plt.savefig(buffer, format=format)
39+
fig.savefig(buffer, format=format)
4140

4241
values = [x.getvalue() for x in buffers]
4342

0 commit comments

Comments
 (0)