tests.test_manager_homebrew module

Homebrew-specific tests.

tests.test_manager_homebrew.test_trust_tap_skips_core_packages(manager_class, package_id)[source]

Core formulae and casks live on trusted taps and must not trigger trust.

tests.test_manager_homebrew.test_trust_tap_qualified_package(manager_class, package_id, tap_id)[source]

Tap-qualified IDs are tapped (idempotent) and trusted before install.

tests.test_manager_homebrew.test_no_greedy_by_default(manager_class)[source]

mpm passes no --greedy of its own: the user adds it per operation.

tests.test_manager_homebrew.test_extra_args_reach_their_own_command(monkeypatch)[source]

extra_args set per operation reach the commands of that operation alone.

A --greedy set through post_args reached brew list, which rejects it (#2171). Set on outdated and upgrade_all, it joins brew outdated and brew upgrade, before the --cask selector, and leaves brew list alone. The brew tap and brew trust helpers of an install get none of the install’s arguments.

tests.test_manager_homebrew.test_install_routes_through_trust_tap(manager_class)[source]

install() always calls trust_tap() so the gate is uniform across paths.

tests.test_manager_homebrew.test_upstream_purls_reads_the_source_package(tmp_path, external_refs, expected)[source]

Only non-brew purls on the source package are lifted.

tests.test_manager_homebrew.test_upstream_purls_ignores_dependency_packages(tmp_path)[source]

A dependency’s own coordinate must not be attributed to the formula.

tests.test_manager_homebrew.test_upstream_purls_degrades_to_empty(sbom_path, formula_name)[source]

A missing or unreadable document costs coverage, never an error.

tests.test_manager_homebrew.test_upstream_purls_tolerates_malformed_json(tmp_path)[source]

A truncated upstream document must not abort the whole scan.

tests.test_manager_homebrew.test_installed_names_a_stale_caskroom_directory(monkeypatch, caplog, stderr, hint)[source]

A cask listing that brew aborted relays the error, plus the fix when known.

tests.test_manager_homebrew.test_brew_prefix(monkeypatch, output, prefix)[source]

brew --prefix locates the Cellar, and a failed call leaves it unknown.

The --formula and --cask selectors stay off the command: they would ask for the prefix of a package instead of the prefix of Homebrew.

tests.test_manager_homebrew.test_package_metadata_batch_skips_an_empty_inventory(monkeypatch)[source]

No package to enrich means no brew info call.

tests.test_manager_homebrew.test_package_metadata_batch_degrades_to_empty(monkeypatch, tmp_path, info)[source]

A brew info that fails or answers no record leaves every package bare.

tests.test_manager_homebrew.test_package_metadata_batch_resolves_every_formula_name(monkeypatch, tmp_path)[source]

A package finds its formula record under each name the record carries.

brew list can report a formula under an old name, an alias or its tap-qualified name. A package that the payload does not describe stays bare.

tests.test_manager_homebrew.test_formula_metadata_maps_the_record(monkeypatch)[source]

A formula record fills the portable fields and the Homebrew extras.

The bottle digest becomes the checksum, each dependency list keeps its scope, and the keg-only reason is kept. With no known prefix, no upstream SBOM is looked up.

tests.test_manager_homebrew.test_formula_metadata_reads_the_sbom_of_the_installed_keg(monkeypatch, tmp_path, keg_version, found, upstream_purls)[source]

The upstream SBOM is read from the keg of the installed version.

The record of ty names 0.0.91 as its stable version, while the host still had 0.0.90 installed, the only keg holding an SBOM. The source package of that document is the one Homebrew wrote, a brew purl beside the PyPI one.

tests.test_manager_homebrew.test_cask_metadata_maps_the_record(monkeypatch, tmp_path, cask, expected)[source]

A cask record fills the portable fields from its leaner schema.

The first of its names is the summary. A no_check digest yields no checksum, and a cask with no auto_updates setting gets no such extra.