Merged
Conversation
- replace `:needs_linux` and `:needs_macos` where `Homebrew::SimulateSystem` already drives the behaviour under test - exercise `launchctl` and `systemctl` discovery through temporary `PATH` entries so service specs run on both platforms - add `reset_launchctl!` so the tests reset cached state without reaching into instance variables
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces platform-gated specs by using Homebrew::SimulateSystem and temporary PATH shims to make the relevant tests exercise discovery logic on both macOS and Linux, while adding a small reset hook to avoid poking cached state via instance variables.
Changes:
- Replace
:needs_linux/:needs_macosin several specs withHomebrew::SimulateSystem.with(...). - Update services-related specs to discover
launchctl/systemctlvia temporary executables inPATH, enabling cross-platform execution. - Add
Homebrew::Services::System.reset_launchctl!to reset cachedlaunchctldiscovery between tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/software_spec_spec.rb | Removes platform gating by simulating OS versions and updating expectations around uses_from_macos. |
| Library/Homebrew/test/services/system_spec.rb | Makes launchctl/systemctl discovery tests portable via temporary PATH executables and cache resets. |
| Library/Homebrew/test/services/system/systemctl_spec.rb | Reworks .executable spec to use a temporary systemctl on PATH instead of platform gating. |
| Library/Homebrew/test/services/cli_spec.rb | Exercises systemd_load/launchctl_load by running temporary shim executables and asserting captured arguments. |
| Library/Homebrew/test/service_spec.rb | Replaces platform-gated service command selection specs with Homebrew::SimulateSystem contexts. |
| Library/Homebrew/services/system.rb | Adds reset_launchctl! to reset cached launchctl path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
p-linnane
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
:needs_linuxand:needs_macoswhereHomebrew::SimulateSystemalready drives the behaviour under testlaunchctlandsystemctldiscovery through temporaryPATHentries so service specs run on both platformsreset_launchctl!so the tests reset cached state without reaching into instance variablesbrew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex with manual review and tweaks.