diff --git a/cmd/yaegi/yaegi_test.go b/cmd/yaegi/yaegi_test.go index ef9e653f6..db005d4fc 100644 --- a/cmd/yaegi/yaegi_test.go +++ b/cmd/yaegi/yaegi_test.go @@ -37,17 +37,7 @@ func applyCIMultiplier(timeout time.Duration) time.Duration { } func TestYaegiCmdCancel(t *testing.T) { - tmp, err := os.MkdirTemp("", "yaegi-") - if err != nil { - t.Fatalf("failed to create tmp directory: %v", err) - } - defer func() { - err = os.RemoveAll(tmp) - if err != nil { - t.Errorf("failed to clean up %v: %v", tmp, err) - } - }() - + tmp := t.TempDir() yaegi := filepath.Join(tmp, "yaegi") args := []string{"build"} diff --git a/interp/src_test.go b/interp/src_test.go index 9944c23af..e69b98b14 100644 --- a/interp/src_test.go +++ b/interp/src_test.go @@ -49,13 +49,7 @@ func Test_effectivePkg(t *testing.T) { func Test_pkgDir(t *testing.T) { // create GOPATH - goPath, err := os.MkdirTemp("", "pkdir") - if err != nil { - t.Fatal(err) - } - defer func() { - _ = os.RemoveAll(goPath) - }() + goPath := t.TempDir() // Create project project := filepath.Join(goPath, "src", "guthib.com", "foo", "root")