Skip to content

test: disable return false handling#22147

Open
hyuraku wants to merge 2 commits intoHomebrew:mainfrom
hyuraku:disable-test-return-false
Open

test: disable return false handling#22147
hyuraku wants to merge 2 commits intoHomebrew:mainfrom
hyuraku:disable-test-return-false

Conversation

@hyuraku
Copy link
Copy Markdown
Contributor

@hyuraku hyuraku commented May 6, 2026


  • 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? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

Upgrade odeprecated to odisabled for return false in formula test blocks. return false was deprecated in #21296 (merged 2025-12-21). The deprecation has been live for ~4.5 months.

Copilot AI review requested due to automatic review settings May 6, 2026 04:38
Copy link
Copy Markdown
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 updates Homebrew’s formula test runner (brew test) to treat formula tests that return false as disabled behavior (via Utils::Output.odisabled) rather than merely deprecated behavior (odeprecated), aligning with the direction of removing “return false” handling in formula test blocks.

Changes:

  • Switch the warning/error mechanism from Utils::Output.odeprecated to Utils::Output.odisabled when a formula test returns false.
  • Make “returning false from tests” behave as a hard-disabled path (raising a MethodDeprecatedError).

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

Comment thread Library/Homebrew/test.rb
Comment thread Library/Homebrew/test.rb
if formula.run_test(keep_tmp: args.keep_tmp?) == false
require "utils/output"
Utils::Output.odeprecated "`return false` in test", "`raise \"<reason for failure>\"`"
Utils::Output.odisabled "`return false` in test", "`raise \"<reason for failure>\"`"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd like to handle this in the follow-up PR that removes the proc wrapper. Adding caller: here is tricky because of define_method, so a redesign later will be cleaner.

Comment thread Library/Homebrew/test.rb
Copy link
Copy Markdown
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.

Thanks @hyuraku! I think we should wait for the next minor release for this. I know we missed it in the last one 🤦🏻 but I think kicking in new disables out of the normal release cycle will be confusing. Will keep this open!

@MikeMcQuaid MikeMcQuaid added the in progress Maintainers are working on this label May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress Maintainers are working on this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants