From 534721126bfdf45c0767c1c3811ab09ef84004a1 Mon Sep 17 00:00:00 2001 From: cgohlke Date: Mon, 10 Mar 2014 22:22:02 -0700 Subject: [PATCH] Fix test_novice.test_update_on_save failure on Windows On Windows, tempfile.NamedTemporaryFile() can not be opened a second time. See --- skimage/novice/tests/test_novice.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/skimage/novice/tests/test_novice.py b/skimage/novice/tests/test_novice.py index 5a4e6003..6b4295b5 100644 --- a/skimage/novice/tests/test_novice.py +++ b/skimage/novice/tests/test_novice.py @@ -111,12 +111,16 @@ def test_update_on_save(): assert pic.modified assert pic.path is None - with tempfile.NamedTemporaryFile(suffix=".jpg") as tmp: - pic.save(tmp.name) + fd, filename = tempfile.mkstemp(suffix=".jpg") + os.close(fd) + try: + pic.save(filename) assert not pic.modified - assert_equal(pic.path, os.path.abspath(tmp.name)) + assert_equal(pic.path, os.path.abspath(filename)) assert_equal(pic.format, "jpeg") + finally: + os.unlink(filename) def test_indexing():