Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use t.TempDir to create temporary test directory #1527

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions cmd/yaegi/yaegi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
8 changes: 1 addition & 7 deletions interp/src_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down