Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cmd/livecheck: avoid watchlist in test #15881

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

samford
Copy link
Member

@samford samford commented Aug 16, 2023

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

The existing watchlist test in test/dev-cmd/livecheck_spec.rb will only pass if the testing environment doesn't contain a livecheck watchlist file. When a watchlist file is present, it ends up being treated as empty (formulae and casks aren't available in tests) and produces an Invalid usage: No formulae or casks to check error instead. We don't have to worry about a watchlist file on CI but it's a potential issue when running brew test locally.

This provides a bogus HOMEBREW_LIVECHECK_WATCHLIST value to the #brew call, to ensure that any watchlist file in the testing environment is not used for this test.


For what it's worth, the test used to pass even if there was a watchlist file when the default location was ~/.brew_livecheck_watchlist. This is because the home directory is HOMEBREW_PREFIX/Library/Homebrew/test/ in tests and there isn't a .brew_livecheck_watchlist file there. The default livecheck watchlist path changed in #15787 such that it's now available in the testing environment, so now we encounter this issue.

@samford samford force-pushed the livecheck/guard-watchlist-test branch from f64ecf8 to c72bc56 Compare August 16, 2023 17:09
The existing watchlist test in `dev-cmd/livecheck_spec.rb` will only
pass if the testing environment doesn't contain a livecheck watchlist
file. When a watchlist file is present, it ends up being treated as
empty (formulae and casks aren't available in tests) and produces an
`Invalid usage: No formulae or casks to check` error instead. We don't
have to worry about a watchlist file on CI but it's a potential issue
when running `brew test` locally.

This provides a bogus `HOMEBREW_LIVECHECK_WATCHLIST` value to the
`#brew` call, to ensure that any watchlist file in the testing
environment is not used for this test.

Co-authored-by: Mike McQuaid <[email protected]>
@samford samford changed the title dev-cmd/livecheck: guard watchlist test dev-cmd/livecheck: avoid watchlist in test Aug 16, 2023
@samford samford force-pushed the livecheck/guard-watchlist-test branch from c72bc56 to 1d404e4 Compare August 16, 2023 19:09
@MikeMcQuaid MikeMcQuaid merged commit 1b2294e into Homebrew:master Aug 16, 2023
24 checks passed
@samford samford deleted the livecheck/guard-watchlist-test branch August 16, 2023 19:44
@github-actions github-actions bot added the outdated PR was locked due to age label Sep 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants