Unit test: properly close image file in test
On Windows it's not allowed to erase a file while it's opened, which caused this error to surface. The file is now properly closed before the test file is erased.
This commit is contained in:
parent
e687c95e5d
commit
15ad890646
@ -95,6 +95,7 @@ func TestProcessImage(t *testing.T) {
|
|||||||
if !assert.NoError(t, err, "thumbnail %s should be openable", spec.filename) {
|
if !assert.NoError(t, err, "thumbnail %s should be openable", spec.filename) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
img, format, err := image.Decode(file)
|
img, format, err := image.Decode(file)
|
||||||
if !assert.NoErrorf(t, err, "thumbnail %s should be decodable", spec.filename) {
|
if !assert.NoErrorf(t, err, "thumbnail %s should be decodable", spec.filename) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user