brew/Library/Homebrew/test/cmd/deps_spec.rb
Mike McQuaid 5cc6722372
Optionally use DownloadQueue for brew install
Allowing using `HOMEBREW_DOWNLOAD_CONCURRENCY` to use the
`DownloadQueue` for `brew install` by downloading and extracting
bottles in parallel.

This requires some fixes in e.g. `Dependency` and `FormulaInstaller`
to be able to front-load all downloads and handle parallelisation of
bottle pouring.

Behaviour without `HOMEBREW_DOWNLOAD_CONCURRENCY` set should be
unchanged.

Attestations are not handled for now and the UI should be improved
before we roll this out to users.

Post-install upgrades are not yet parallelised.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-18 15:00:23 +01:00

46 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require "cmd/deps"
require "cmd/shared_examples/args_parse"
RSpec.describe Homebrew::Cmd::Deps do
include FileUtils
it_behaves_like "parseable arguments"
it "outputs all of a Formula's dependencies and their dependencies on separate lines", :integration_test, :no_api do
# Included in output
setup_test_formula "bar"
setup_test_formula "foo"
setup_test_formula "test"
# Excluded from output
setup_test_formula "baz", <<~RUBY
url "https://brew.sh/baz-1.0"
depends_on "bar"
depends_on "build" => :build
depends_on "test" => :test
depends_on "optional" => :optional
depends_on "recommended_test" => [:recommended, :test]
depends_on "installed"
RUBY
setup_test_formula "build"
setup_test_formula "optional"
setup_test_formula "recommended_test"
setup_test_formula "installed"
# Mock `Formula#any_version_installed?` by creating the tab in a plausible keg directory and opt link
keg_dir = HOMEBREW_CELLAR/"installed/1.0"
keg_dir.mkpath
touch keg_dir/AbstractTab::FILENAME
opt_link = HOMEBREW_PREFIX/"opt/installed"
opt_link.parent.mkpath
FileUtils.ln_sf keg_dir, opt_link
expect { brew "deps", "baz", "--include-test", "--missing", "--skip-recommended" }
.to be_a_success
.and output("bar\nfoo\ntest\n").to_stdout
.and output(/not the actual runtime dependencies/).to_stderr
end
end