mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-24 13:20:43 +08:00
Fix test_novice.test_update_on_save failure on Windows
On Windows, tempfile.NamedTemporaryFile() can not be opened a second time. See <http://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile>
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user