Replace os.MkdirTemp() with t.TempDir() and os.Setenv() with t.Setenv() Remove manual environment cleanup as t.Setenv handles it automatically