Skip to content

Flag uses of os.{Setenv,Chdir}() in tests #1707

@arp242

Description

@arp242

Test functions should use testing.T.{Setenv,Chdir} instead; these helpers will correctly restore the previous value with t.Cleanup() and prevent t.Parallel()

I can't really think of any scenario where you would call the os versions in a test?

Possibly also os.TempDir() and os.{CreateTemp,MkdirTemp}() (when called with the default directory or os.TempDir())?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions