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

Skip to content

Commit 0a6ee42

Browse files
committed
TST: On Windows open files can not be removed
1 parent aec5a56 commit 0a6ee42

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ def test_multipage_keep_empty():
6666
assert os.path.exists(filename)
6767
os.remove(filename)
6868
# test if an empty pdf is deleting itself afterwards with keep_empty=False
69-
with NamedTemporaryFile(delete=False) as tmp:
70-
with PdfPages(tmp, keep_empty=False) as pdf:
71-
filename = pdf._file.fh.name
72-
assert not os.path.exists(filename)
69+
with PdfPages(filename, keep_empty=False) as pdf:
70+
pass
71+
assert not os.path.exists(filename)
7372
### test pdf files with content, they should never be deleted
7473
fig = plt.figure()
7574
ax = fig.add_subplot(111)

0 commit comments

Comments
 (0)