Skip to content

test/cmd/update_spec: fix local test run failures#22906

Merged
cho-m merged 1 commit into
mainfrom
test-avoid-possible-failure
Jun 29, 2026
Merged

test/cmd/update_spec: fix local test run failures#22906
cho-m merged 1 commit into
mainfrom
test-avoid-possible-failure

Conversation

@cho-m

@cho-m cho-m commented Jun 29, 2026

Copy link
Copy Markdown
Member

brew tests is a developer command so running it triggers HOMEBREW_DEV_CMD_RUN and causes failures for some tests set up for stable brew tags.

Mainly to allow running tests locally for development purposes. Otherwise can see failures like following (at least in Linux container):

     1.1) Failure/Error: expect(stderr).to be_empty
            expected `"unexpected curl https://api.github.com/repos/Homebrew/brew/commits/main\n".empty?` to be truthy, got false
          # ./test/cmd/update_spec.rb:316:in 'block (2 levels) in <main>'

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • AI was used to generate or assist with generating this PR.

`brew tests` is a developer command so running it triggers
HOMEBREW_DEV_CMD_RUN and causes failures for some tests set up for
stable brew tags.
Copilot AI review requested due to automatic review settings June 29, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 makes Library/Homebrew/test/cmd/update_spec.rb resilient to being executed in an environment where HOMEBREW_DEV_CMD_RUN is set (e.g. when running the test suite via the developer command brew tests). It ensures the update script behaves as the specs expect (stable-tag update behavior) when spawned via Open3.capture3.

Changes:

  • Explicitly unset HOMEBREW_DEV_CMD_RUN in the environment passed to run_update_shell for the affected examples.
  • Prevents unexpected curl requests to .../commits/main during these tests when HOMEBREW_DEV_CMD_RUN would otherwise be inherited.

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

@cho-m cho-m added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 8889556 Jun 29, 2026
45 checks passed
@cho-m cho-m deleted the test-avoid-possible-failure branch June 29, 2026 17:42
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