8000 TST: Avoid using os.devnull for path tests · matplotlib/matplotlib@8702cc5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8702cc5

Browse files
committed
TST: Avoid using os.devnull for path tests
On wasm, this file doesn't support seeking, which is sometimes necessary depending on file type.
1 parent f1b6047 commit 8702cc5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ def test_text_urls_tex():
307307
assert annot.Rect[1] == decimal.Decimal('0.7') * 72
308308

309309

310-
def test_pdfpages_fspath():
311-
with PdfPages(Path(os.devnull)) as pdf:
310+
def test_pdfpages_fspath(tmp_path):
311+
with PdfPages(tmp_path / 'unused.pdf') as pdf:
312312
pdf.savefig(plt.figure())
313313

314314

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ def test_imsave_rgba_origin(origin):
193193

194194

195195
@pytest.mark.parametrize("fmt", ["png", "pdf", "ps", "eps", "svg"])
196-
def test_imsave_fspath(fmt):
197-
plt.imsave(Path(os.devnull), np.array([[0, 1]]), format=fmt)
196+
def test_imsave_fspath(fmt, tmp_path):
197+
plt.imsave(tmp_path / f'unused.{fmt}', np.array([[0, 1]]), format=fmt)
198198

199199

200200
def test_imsave_color_alpha():

0 commit comments

Comments
 (0)
0