Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0875fb2

Browse filesBrowse files
committed
Skip setting up a tmpdir in tests that don't need one.
1 parent 56d9e7c commit 0875fb2
Copy full SHA for 0875fb2

File tree

Expand file treeCollapse file tree

3 files changed

+7
-17
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-17
lines changed

‎lib/matplotlib/tests/test_backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_bases.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ def test_canvas_ctor():
5959
assert isinstance(FigureCanvasBase().figure, Figure)
6060

6161

62-
def test_get_default_filename(tmpdir):
63-
plt.rcParams['savefig.directory'] = str(tmpdir)
64-
fig = plt.figure()
65-
canvas = FigureCanvasBase(fig)
66-
filename = canvas.get_default_filename()
67-
assert filename == 'image.png'
62+
def test_get_default_filename():
63+
assert plt.figure().canvas.get_default_filename() == 'image.png'
6864

6965

7066
def test_canvas_change():

‎lib/matplotlib/tests/test_backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pdf.py
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,11 @@ def test_pdf_eps_savefig_when_color_is_none(fig_test, fig_ref):
315315

316316

317317
@needs_usetex
318-
def test_failing_latex(tmpdir):
318+
def test_failing_latex():
319319
"""Test failing latex subprocess call"""
320-
path = str(tmpdir.join("tmpoutput.pdf"))
321-
322-
rcParams['text.usetex'] = True
323-
324-
# This fails with "Double subscript"
325-
plt.xlabel("$22_2_2$")
320+
plt.xlabel("$22_2_2$", usetex=True) # This fails with "Double subscript"
326321
with pytest.raises(RuntimeError):
327-
plt.savefig(path)
322+
plt.savefig(io.BytesIO(), format="pdf")
328323

329324

330325
def test_empty_rasterized():

‎lib/matplotlib/tests/test_backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pgf.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,10 @@ def test_tex_restart_after_error():
312312

313313

314314
@needs_xelatex
315-
def test_bbox_inches_tight(tmpdir):
315+
def test_bbox_inches_tight():
316316
fig, ax = plt.subplots()
317317
ax.imshow([[0, 1], [2, 3]])
318-
fig.savefig(os.path.join(tmpdir, "test.pdf"), backend="pgf",
319-
bbox_inches="tight")
318+
fig.savefig(BytesIO(), format="pdf", backend="pgf", bbox_inches="tight")
320319

321320

322321
@needs_xelatex

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.