Skip to content

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Nov 23, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Writing files to main HOMEBREW_LIBRARY path can cause race conditions like with SimpleCov.

Seen in #21120.

Copilot AI review requested due to automatic review settings November 23, 2025 20:23
Copilot finished reviewing on behalf of cho-m November 23, 2025 20:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors test file creation in commands_spec.rb to use a temporary directory instead of writing directly to the main HOMEBREW_LIBRARY path. This change prevents race conditions, particularly with SimpleCov as mentioned in the related issue #21120.

  • Introduces tmpdir-based file creation for test isolation
  • Uses constant stubbing to redirect Commands module paths to test directories
  • Updates test expectations to use stubbed constants instead of hardcoded paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @cho-m!

@botantony botantony force-pushed the commands_spec-tmpdir branch from b87aa9c to d7f6544 Compare November 24, 2025 13:16
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 24, 2025
Merged via the queue into main with commit d5d28c2 Nov 24, 2025
35 checks passed
@MikeMcQuaid MikeMcQuaid deleted the commands_spec-tmpdir branch November 24, 2025 14:01
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