8000 Save SVG test directly to file instead of its name. · matplotlib/matplotlib@2679ddd · GitHub
[go: up one dir, main page]

Skip to content

Commit 2679ddd

Browse files
committed
Save SVG test directly to file instead of its name.
Windows doesn't like opening files twice, so this needs to save to the file name _outside_ the context (after it's been closed), or simply write to the file object directly. There doesn't seem to be any pressing need to use the file name, so just use the file object.
1 parent 7131876 commit 2679ddd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def test_missing 7196 _psfont(mock):
217217
rc('text', usetex=True)
218218
fig, ax = plt.subplots()
219219
ax.text(0.5, 0.5, 'hello')
220-
with tempfile.NamedTemporaryFile(suffix='.svg') as tmpfile:
221-
fig.savefig(tmpfile.name)
220+
with tempfile.TemporaryFile() as tmpfile:
221+
fig.savefig(tmpfile, format='svg')
222222

223223

224224
if __name__ == '__main__':

0 commit comments

Comments
 (0)
0