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

Refactor tests #119

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Refactor tests #119

wants to merge 2 commits into from

Conversation

nezlobnaya
Copy link
Contributor

Using t.Setenv instead of os.Setenv in tests provides a safer and more controlled way to manage environment variables during test runs. The t.Setenv method automatically restores the original environment variables at the end of the test, preventing potential pollution of the global environment state that could affect other tests.
Ensure os.Args is restored after modification to prevent test pollution. Restoring os.Args helps maintain isolation between tests, ensuring that each test starts with a clean state.

Signed-off-by: Vlad Burlutskiy <vlad.burlutskiy@icloud.com>
Signed-off-by: Vlad Burlutskiy <vlad.burlutskiy@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant