From ee755c6c0b58b4669412b8cfd007a31fe8d4b677 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 7 Oct 2014 07:02:01 -0500 Subject: [PATCH] Remove temporary file and clean up imports --- skimage/_shared/testing.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/skimage/_shared/testing.py b/skimage/_shared/testing.py index be58540a..510bf03d 100644 --- a/skimage/_shared/testing.py +++ b/skimage/_shared/testing.py @@ -1,11 +1,12 @@ """Testing utilities.""" +import os import re from tempfile import NamedTemporaryFile from skimage import ( - data, io, img_as_uint, img_as_bool, img_as_float, img_as_int, img_as_ubyte) + data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte) from numpy import testing import numpy as np @@ -91,6 +92,10 @@ def roundtrip(img, plugin, suffix): temp_file.close() fname = temp_file.name io.imsave(fname, img, plugin=plugin) + try: + os.remove(fname) + except Exception: + pass return io.imread(fname, plugin=plugin)