Skip to content

Conversation

@amacneil
Copy link
Owner

@amacneil amacneil commented Jan 8, 2026

Remove redundant t.Chdir(cwd) call and add comments to clarify directory cleanup in TestLoadEnvFiles.

Identified by #709 (comment) although that bugbot comment was incorrect.

The t.Chdir function automatically registers a cleanup to restore the original directory, making the explicit t.Chdir(cwd) call in the t.Cleanup block redundant. This change simplifies the test setup and clarifies that t.Chdir handles its own directory restoration.


Open in Cursor Open in Web


Note

Simplifies TestLoadEnvFiles setup by relying on t.Chdir's built-in directory restoration and tightening environment handling.

  • Removes manual cwd tracking and redundant t.Chdir(cwd) from t.Cleanup
  • Keeps os.Clearenv() after t.Chdir (since it sets PWD) and restores env vars in t.Cleanup
  • Adds clarifying comments about directory and environment cleanup

Written by Cursor Bugbot for commit 159749d. This will update automatically on new commits. Configure here.

Co-authored-by: adrian <adrian@foxglove.dev>
@cursor
Copy link

cursor bot commented Jan 8, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@amacneil amacneil changed the title Test cleanup directory bug Remove redundant t.Chdir() Jan 8, 2026
@amacneil amacneil requested a review from sofuture January 8, 2026 23:57
@amacneil amacneil marked this pull request as ready for review January 8, 2026 23:57
@amacneil amacneil merged commit e382191 into main Jan 8, 2026
11 checks passed
@amacneil amacneil deleted the cursor/test-cleanup-directory-bug-e0e8 branch January 8, 2026 23:57
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.

3 participants