@@ -109,19 +109,15 @@ func TestDownloadRemote(t *testing.T) {
109
109
}
110
110
111
111
func TestDownloadLocal (t * testing.T ) {
112
-
113
- if runtime .GOOS == "windows" {
114
- // FIXME: `TempDir RemoveAll cleanup: remove C:\users\runner\Temp\TestDownloadLocalwithout_digest2738386858\002\test-file: Sharing violation.`
115
- t .Skip ("Skipping on windows" )
116
- }
117
-
118
112
const emptyFileDigest = "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
119
113
const testDownloadLocalDigest = "sha256:0c1e0fba69e8919b306d030bf491e3e0c46cf0a8140ff5d7516ba3a83cbea5b3"
120
114
121
115
t .Run ("without digest" , func (t * testing.T ) {
122
116
localPath := filepath .Join (t .TempDir (), t .Name ())
123
117
localFile := filepath .Join (t .TempDir (), "test-file" )
124
- os .Create (localFile )
118
+ f , err := os .Create (localFile )
119
+ assert .NilError (t , err )
120
+ t .Cleanup (func () { _ = f .Close () })
125
121
testLocalFileURL := "file://" + localFile
126
122
127
123
r , err := Download (localPath , testLocalFileURL )
@@ -150,11 +146,13 @@ func TestDownloadLocal(t *testing.T) {
150
146
151
147
t .Run ("cached" , func (t * testing.T ) {
152
148
localFile := filepath .Join (t .TempDir (), "test-file" )
153
- os .Create (localFile )
149
+ f , err := os .Create (localFile )
150
+ assert .NilError (t , err )
151
+ t .Cleanup (func () { _ = f .Close () })
154
152
testLocalFileURL := "file://" + localFile
155
153
156
154
cacheDir := filepath .Join (t .TempDir (), "cache" )
157
- _ , err : = Cached (testLocalFileURL , WithCacheDir (cacheDir ))
155
+ _ , err = Cached (testLocalFileURL , WithCacheDir (cacheDir ))
158
156
assert .ErrorContains (t , err , "not cached" )
159
157
})
160
158
}
0 commit comments