tests.test_manager_pip moduleΒΆ

Pip-specific tests for bundled-app detection, interpreter discovery and metadata.

tests.test_manager_pip.test_running_from_bundled_app(prefix, distribution, bundled)[source]ΒΆ

A bundle is told by its sys.prefix and the INSTALLER record of mpm.

tests.test_manager_pip.test_pip_install_blocked_parses_probe(stdout, expected)[source]ΒΆ

The probe’s 1/0 output maps to blocked/not-blocked.

tests.test_manager_pip.test_probe_keeps_candidate_on_error(probe, error)[source]ΒΆ

A failed probe must not hide a candidate: both probes answer False.

tests.test_manager_pip.test_search_prepends_current_interpreter_for_user_install()[source]ΒΆ

A normal install probes the running interpreter first.

tests.test_manager_pip.test_search_skips_bundled_interpreter()[source]ΒΆ

A distributor bundle skips the running interpreter and falls back to PATH.

tests.test_manager_pip.test_search_skips_pep668_blocked_candidate()[source]ΒΆ

Externally-managed, non-virtualenv interpreters (PEP 668) are dropped.

tests.test_manager_pip.test_search_unavailable_when_all_candidates_blocked()[source]ΒΆ

With every interpreter blocked, discovery yields nothing (pip unavailable).

tests.test_manager_pip.test_pip_module_missing_parses_probe(stdout, returncode, expected)[source]ΒΆ

The marked answer decides, and a failure without one drops the candidate.

tests.test_manager_pip.test_pip_module_missing_reads_past_undecodable_output()[source]ΒΆ

An answer behind bytes that are no UTF-8 still decides.

The candidate is the running interpreter, which prints a Latin-1 KΓΆln before the marked answer.

tests.test_manager_pip.test_search_skips_running_interpreter_without_pip()[source]ΒΆ

A standalone-app virtualenv carries no pip, so discovery falls through.

uv tool install and pipx build mpm its own virtualenv and seed no pip into it. Selecting that interpreter would leave every python -m pip call failing against an environment the user never asked mpm to manage.

tests.test_manager_pip.test_split_dep_spec(spec, expected)[source]ΒΆ

A requirement splits into its name, its extras and its version constraint.

tests.test_manager_pip.test_distribution_metadata(tmp_path, metadata, expected)[source]ΒΆ

The core metadata of a distribution fills the portable fields.

A Home-page header wins over every Project-URL, whose labels otherwise pick the homepage, the repository and the tracker. The license comes from License-Expression, else from License, of which a text keeps its first line. The maintainer stands in for a missing author, then the name of the first entry of the address field, whose address is kept alone. A requirement keeps its name and its constraint, but not its extras, and is optional when its environment marker names an extra.

tests.test_manager_pip.test_package_metadata_batch_skips_an_empty_inventory()[source]ΒΆ

No package to enrich means no distribution lookup.

tests.test_manager_pip.test_package_metadata_batch_enriches_each_package_alone(tmp_path, encoding, enriched)[source]ΒΆ

A package whose metadata cannot be read stays bare beside the others.

One package is unknown to the environment. In the second case, the METADATA file of the other one is no valid UTF-8, like the file of an old installer that wrote in the platform encoding.