initwd Windows tests fixes (#1723)

Signed-off-by: eduzgun <emreduz00@gmail.com>
Signed-off-by: Emre Duzgun <100037959+eduzgun@users.noreply.github.com>
This commit is contained in:
Emre Duzgun
2024-06-18 15:49:30 +01:00
committed by GitHub
parent 3fdc809050
commit 502877dbf7
4 changed files with 14 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ import (
"context"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
@@ -281,6 +282,11 @@ func TestDirFromModule_rel_submodules(t *testing.T) {
}
t.Cleanup(func() {
os.Chdir(oldDir)
// Trigger garbage collection to ensure that all open file handles are closed.
// This prevents TempDir RemoveAll cleanup errors on Windows.
if runtime.GOOS == "windows" {
runtime.GC()
}
})
hooks := &testInstallHooks{}