Skip to content

Commit f0a614e

Browse files
authored
Merge pull request #1530 from cbm755/test_droppings
test was leaving a file behind
2 parents 6b3c598 + db71007 commit f0a614e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/test_pixmap.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,15 @@ def test_pilsave():
6464
pass
6565

6666

67-
def test_save():
67+
def test_save(tmpdir):
6868
# pixmaps from file then save to image
6969
# make pixmap from this and confirm equality
7070
pix1 = fitz.Pixmap(imgfile)
71-
stream2 = pix1.tobytes("png")
72-
fp = tempfile.TemporaryFile()
73-
pix1.save(str(fp.name), output="png")
74-
try:
75-
os.remove(fp.name)
76-
except:
77-
pass
71+
outfile = os.path.join(tmpdir, "foo.png")
72+
pix1.save(outfile, output="png")
73+
# read it back
74+
pix2 = fitz.Pixmap(outfile)
75+
assert repr(pix1) == repr(pix2)
7876

7977

8078
def test_setalpha():

0 commit comments

Comments
 (0)