8000 test_foreign uses /tmp · libvips/pyvips@c81436e · GitHub
[go: up one dir, main page]

Skip to content

Commit c81436e

Browse files
committed
test_foreign uses /tmp
all temp files now made with mkstemp
1 parent d449900 commit c81436e

File tree

3 files changed

+149
-103
lines changed

3 files changed

+149
-103
lines changed

pyvips/tests/helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import math
99
from functools import reduce
1010
import shutil
11+
import tempfile
1112
from tempfile import NamedTemporaryFile
1213

1314
import pyvips
@@ -142,6 +143,14 @@ def run_fn(fn, x):
142143
else:
143144
return fn(x)
144145

146+
# make a temp filename with the specified suffix
147+
def temp_filename(suffix):
148+
handle, filename = tempfile.mkstemp(suffix)
149+
os.close(handle)
150+
os.unlink(filename)
151+
152+
return filename
153+
145154
# run a 2-ary function on two things -- loop over elements pairwise if the
146155
# things are lists
147156
def run_fn2(fn, x, y):

0 commit comments

Comments
 (0)
0