From 4c64193b9b10021aa9b3903e67738de1a6777985 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 17 Apr 2024 22:17:47 +0100 Subject: [PATCH] Set `HOMEBREW_DEBUG` when running `brew tests --debug` - This will cause the "debug" gem to be required in `spec_helper.rb`, so we can do interactive debugging. --- Library/Homebrew/dev-cmd/tests.rb | 4 ++-- Library/Homebrew/test/migrator_spec.rb | 2 -- Library/Homebrew/test/spec_helper.rb | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index f99ab7e6a846e..0a3a99b2d19e7 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -45,8 +45,6 @@ def run # Given we might be testing various commands, we probably want everything (except sorbet-static) Homebrew.install_bundler_gems!(groups: Homebrew.valid_gem_groups - ["sorbet"]) - require "debug" if args.debug? - HOMEBREW_LIBRARY_PATH.cd do setup_environment! @@ -137,6 +135,8 @@ def run puts "Randomized with seed #{seed}" + ENV["HOMEBREW_DEBUG"] = "1" if args.debug? # Used in spec_helper.rb to require the "debug" gem. + # Submit test flakiness information using BuildPulse # BUILDPULSE used in spec_helper.rb if use_buildpulse? diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 4494b919b7345..87fadd5e95555 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -69,8 +69,6 @@ tab.source["tap"] = "homebrew/core" tab.write - binding.b - expect do described_class.new(new_formula, "oldname") end.to raise_error(Migrator::MigratorDifferentTapsError) diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 517acadb8cc26..b525f7a11bc7e 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -37,6 +37,8 @@ require_relative "../global" +require "debug" if ENV["HOMEBREW_DEBUG"] + require "test/support/quiet_progress_formatter" require "test/support/helper/cask" require "test/support/helper/files"