Merge pull request #1107 from mostynb/test_environment_tempdir

Save the temp dir before clearing environment variables
This commit is contained in:
Robert Liebowitz 2020-04-14 06:40:52 -04:00 committed by GitHub
commit 3b22cad8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,8 @@ import (
"time" "time"
) )
var osTempDir = os.TempDir()
var boolFlagTests = []struct { var boolFlagTests = []struct {
name string name string
expected string expected string
@ -1662,7 +1664,7 @@ func TestFlagFromFile(t *testing.T) {
os.Clearenv() os.Clearenv()
os.Setenv("APP_FOO", "123") os.Setenv("APP_FOO", "123")
temp, err := ioutil.TempFile("", "urfave_cli_test") temp, err := ioutil.TempFile(osTempDir, "urfave_cli_test")
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return