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

Skip to content

Commit 0fd4b59

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 906b895 commit 0fd4b59

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime
22
import decimal
33
import io
4-
import os
54
from pathlib import Path
65

76
import numpy as np
@@ -291,8 +290,8 @@ def test_text_urls_tex():
291290
assert annot.Rect[1] == decimal.Decimal('0.7') * 72
292291

293292

294-
def test_pdfpages_fspath():
295-
with PdfPages(Path(os.devnull)) as pdf:
293+
def test_pdfpages_fspath(tmp_path):
294+
with PdfPages(tmp_path / 'unused.pdf') as pdf:
296295
pdf.savefig(plt.figure())
297296

298297

lib/matplotlib/tests/test_image.py

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

216216

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

221221

222222
def test_imsave_color_alpha():

0 commit comments

Comments
 (0)
0