Skip to content

test/formula_spec: mock cached_download to avoid slow test - #24171

Merged
MikeMcQuaid merged 1 commit into
mainfrom
formula_spec-cached_download
Oct 5, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
formula_spec-cached_download

Conversation

@cho-m

@cho-m cho-m commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

I applied a Copilot suggestion back in prior PR to use cached_download but this causes slowdown in tests when download doesn't exist. I think it tries to access url via curl to resolve filename from headers.

So mock a value to avoid increasing testcase time.

Prior to this, brew tests --only formula --profile 5 would have 3 of these hit 7+ seconds making them significantly slower than rest. After changes, these no longer show up in slowest tests.


  • 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 brew benchmark results.
  • 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?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

n/a


Copilot AI lite review requested due to automatic review settings October 5, 2026 17:22

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.

Copilot review overview

馃煝 Approval recommended

No unresolved review comments remain.

Review effort: Lite
Findings: None

What changed in this PR

Updates formula_spec to avoid slow download resolution in std_go_args tests.

Changes:

  • Uses a realistic tarball URL.
  • Mocks cached downloads and Git metadata lookups.
  • Preserves coverage for revision and repository cases.
File Description
Library/鈥婬omebrew/鈥媡est/鈥媐ormula_spec.rb Speeds up tests with deterministic download mocks.

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit 5327ac6 Oct 5, 2026
55 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the formula_spec-cached_download branch October 5, 2026 18:04
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.

4 participants