tests.test_brewfile module

Unit tests of the Brewfile renderer (meta_package_manager.brewfile).

Pure-function tests over duck-typed manager stubs: no CLI invocation, no real manager pool iteration. The mpm dump command driving the renderer is exercised in tests.test_cli_dump.

tests.test_brewfile.test_quote_ascii()[source]
tests.test_brewfile.test_quote_escapes_backslash_and_quote()[source]
tests.test_brewfile.test_quote_non_ascii_passes_through()[source]
tests.test_brewfile.test_format_entry(entry_type, name, options, expected)[source]
tests.test_brewfile.test_tap_from_package_id(package_id, tap)[source]
tests.test_brewfile.test_format_header_lists_coverage_and_skipped()[source]
tests.test_brewfile.test_format_header_empty_coverage_marker()[source]
tests.test_brewfile.test_bundle_entry_types_ordering()[source]
tests.test_brewfile.test_build_brewfile_brew_cask_sorted_alphabetically()[source]
tests.test_brewfile.test_build_brewfile_emits_tap_lines_for_third_party_taps()[source]
tests.test_brewfile.test_build_brewfile_skips_managers_without_entry_type()[source]
tests.test_brewfile.test_build_brewfile_header_records_skipped_counts()[source]
tests.test_brewfile.test_mas_brewfile_entry_uses_name_and_numeric_id()[source]

mas Brewfile entries take the app display name + id: keyword.

tests.test_brewfile.test_mas_brewfile_entry_skips_non_numeric_id()[source]

A mas Package without a numeric adamID cannot round-trip; skip it.

tests.test_brewfile.test_mas_brewfile_entry_falls_back_to_id_when_name_missing()[source]

A mas Package with no display name uses the adamID string as the entry.

tests.test_brewfile.test_vscodium_brewfile_skip_warning_set()[source]

VSCodium’s definition declares no brewfile_entry_type.

Its extensions are then not silently emitted as vscode, which would install to VS Code instead of VSCodium. The warning is the audible signal.

tests.test_brewfile.test_phase_2_to_4_managers_have_brewfile_entry_types()[source]

Every brew-bundle-supported manager except go and krew has a mapping.

Catches regressions if a manager’s class is reorganized (or converted to a bundled definition) and the attribute is dropped.

tests.test_brewfile.test_build_brewfile_round_trip_format_is_parseable_by_ruby_inspect()[source]

The emitted lines should round-trip through Ruby String#inspect rules.

quote uses json.dumps(ensure_ascii=False) which produces double-quoted strings with backslash escapes for control chars: a subset of what Ruby’s inspect emits, accepted as a valid Ruby literal.

tests.test_brewfile.test_brew_bundle_check_parses_generated_brewfile(tmp_path)[source]

Pipe a generated Brewfile through brew bundle check to catch DSL drift.

The Brewfile comes from build_brewfile().

Uses a synthetic package set so the test runs in milliseconds rather than iterating the real manager pool. The point of the check is format validity (does brew parse what we emit?), not “does mpm see what brew sees on this host?”.