tests.test_orphans module¶
Checks for the two orphan features and their native-command mappings.
remove --orphans (scoped,
remove_orphan()) drops one
package’s own orphaned dependencies; cleanup --orphans (system-wide,
cleanup_orphan()) sweeps every
orphaned package. mark_explicit keeps both from removing a package the user
installed again while the manager still held it as a dependency. The argv
assertions stub run_cli on the pooled manager singleton to capture command
tokens without spawning a subprocess, so they run identically on any host.
- tests.test_orphans.test_remove_orphan_uses_native_cascade(monkeypatch, manager_id, cascade_token)[source]¶
remove --orphansmaps to each manager’s native remove-plus-orphans verb.
- tests.test_orphans.test_plain_remove_no_longer_cascades(monkeypatch, manager_id, cascade_token)[source]¶
Plain
removekeeps orphaned dependencies: dnf and xbps used to cascade.
- tests.test_orphans.test_remove_orphan_unsupported_raises_not_implemented(manager_id)[source]¶
A manager with no scoped cascade leaves
remove_orphanunimplemented.The CLI action then catches the
NotImplementedErrorand falls back to a plain removal.
- tests.test_orphans.test_cleanup_orphan_uses_native_sweep(monkeypatch, manager_id, sweep_token)[source]¶
cleanup --orphansmaps to each manager’s system-wide orphan sweep.
- tests.test_orphans.test_plain_cleanup_never_sweeps(monkeypatch, manager_id, sweep_token, cache_token)[source]¶
The
cleanupcomposer runs the non-destructive categories only.The orphan sweep stays behind an explicit
--orphans, even where a native sweep exists.
- tests.test_orphans.test_cleanup_orphan_unsupported_raises_not_implemented(manager_id)[source]¶
A manager with no sweep and no
orphansquery raises from the base.It propagates
NotImplementedErrorfrom the base sweep, socleanup --orphansskips it.
- tests.test_orphans.test_cleanup_orphan_capability_matrix(manager_id, synthesized, supported)[source]¶
The synthesized sweep covers exactly the managers that need it.
Those managers have an orphan listing and per-package removal but no native sweep verb, which mirrors
upgrade --all.
- tests.test_orphans.test_cleanup_category_support(manager_id, cache_support, repair_support)[source]¶
Category support is a plain method-override check.
Every manager declares its cleanup work through category methods, never a monolithic
cleanup.
- tests.test_orphans.test_cleanup_category_argv(monkeypatch, manager_id, method, token)[source]¶
The extracted category steps run their native commands.
- tests.test_orphans.test_synthesized_sweep_fixpoint(monkeypatch)[source]¶
The synthesized sweep re-queries between rounds until the list settles.
Removing an orphan can orphan its own dependencies.
- tests.test_orphans.test_synthesized_sweep_stops_without_progress(monkeypatch)[source]¶
A removal that keeps failing cannot spin the loop.
Two identical consecutive listings end the sweep.
- tests.test_orphans.test_orphans_parsing(monkeypatch, stub_run_cli, manager_id, output, expected)[source]¶
Each manager’s
orphansquery parses its native listing into packages.The canned outputs mirror the
shell-sessionsamples of theorphansdocstrings, so the documented format and the tested format cannot drift apart.
- tests.test_orphans.test_orphans_query_unsupported(manager_id)[source]¶
Managers without a native read-only orphan listing do not advertise
orphans.This includes cask: casks are never installed as dependencies.
- tests.test_orphans.test_implements_method_introspection()[source]¶
implements_methodreports overrides of the baseNotImplementedErrorstubs.It uses the same MRO walk the CLI and the docs generator rely on.
- tests.test_orphans.test_base_orphan_operations_not_implemented()[source]¶
Both operations are optional, exactly like
removeandcleanup.
- tests.test_orphans.EXPLICIT_INSTALL_NOT_MARKED = {'brew': '`brew install` sets `installed_on_request` on a formula it holds.', 'cask': '`brew autoremove` never removes a cask.', 'cave': '`cave resolve` adds its target to the world set.', 'claude-code-plugins': '`plugin install` clears the `auto` flag of a plugin.', 'elan': '`toolchain gc` removes unused toolchains, whatever the reason.', 'emerge': '`emerge` adds its target to the world set.', 'juliaup': '`gc` keeps every version a channel points at.', 'pkg-tools': '`pkg_add` tags an installed package as installed manually.', 'pmerge': '`pmerge` adds its target to the world set.', 'spack': '`spack install` marks an installed spec as explicit.', 'vagrant': '`box prune` removes older box versions, whatever the reason.', 'zypper': 'zypper has no command that changes only the install reason.'}¶
Managers that remove orphans but need no
mark_explicit, with the reason.
- tests.test_orphans.test_orphan_removal_spares_explicit_installs(manager)[source]¶
A manager that removes orphans marks an explicit install, or says why not.
- tests.test_orphans.test_explicit_install_exemptions_remove_orphans()[source]¶
Every exemption names a manager that still removes orphans.
- tests.test_orphans.test_mark_explicit_uses_native_command(monkeypatch, manager_id, expected)[source]¶
mark_explicitruns the command that changes only the install reason.
- tests.test_orphans.test_yum_mark_explicit_follows_dnf_generation(monkeypatch, version, verb)[source]¶
yumfronts dnf4 or dnf5, whosemarkverbs differ.
- tests.test_orphans.test_flatpak_may_hold_only_runtimes_as_dependencies(stub_run_cli, package_id, expected)[source]¶
Only an installed runtime can be a dependency, by ID or by
ID//BRANCH.
- tests.test_orphans.test_flatpak_may_hold_as_dependency_survives_a_failed_listing(monkeypatch)[source]¶
- class tests.test_orphans.RemovableFakeManager[source]¶
Bases:
FakeManagerFake manager that removes packages but has no scoped orphan-cascade verb.
Exercises the
remove --orphansfallback:remove_orphanstays unimplemented (baseNotImplementedError) whileremovesucceeds, so the CLI must catch the former and fall back to the latter.Initialize
cli_errorslist.- remove(package_id)[source]¶
Remove one package and one only.
Optional. Will be simply skipped by mpm if not implemented.
- Return type:
- cli_names: tuple[str, ...] = ('removablefakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'removablefakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'RemovableFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- class tests.test_orphans.CleanupFakeManager[source]¶
Bases:
FakeManagerFake manager with a cache category only: no system-wide orphan sweep.
Initialize
cli_errorslist.- cleanup_cache()[source]¶
Prune the manager’s caches, downloads and other left-over artifacts.
The cache category of
cleanup(), surfaced asmpm cleanup --cacheand subtracted by--skip-cache(apt clean,dnf clean all,brew cleanup,npm cache clean, …). The broadest category: for most managers the whole cleanup amounts to it.Optional. Will be simply skipped by mpm if not implemented.
- Return type:
- cli_names: tuple[str, ...] = ('cleanupfakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'cleanupfakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'CleanupFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- class tests.test_orphans.SweepSynthesizingFakeManager[source]¶
Bases:
CleanupFakeManagerFake manager with cleanup, orphan listing and removal, but no sweep.
The orphan listing is inherited, and it has no native sweep verb: cleanup –orphans``must go through the synthesized base sweep, never the full``cleanup.
Initialize
cli_errorslist.- remove(package_id)[source]¶
Remove one package and one only.
Optional. Will be simply skipped by mpm if not implemented.
- Return type:
- cli_names: tuple[str, ...] = ('sweepsynthesizingfakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'sweepsynthesizingfakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'SweepSynthesizingFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- class tests.test_orphans.DecomposedCleanupFakeManager[source]¶
Bases:
CleanupFakeManagerFake manager with both orphan and cache category steps.
Initialize
cli_errorslist.- cleanup_orphan()[source]¶
Remove every orphaned package on the system, sparing the caches.
The system-wide “remove all packages nothing depends on anymore” sweep (
apt autoremove,brew autoremove,flatpak uninstall --unused, …). The one cleanup category that removes packages, so it is deliberately kept out of the plaincleanup()composition and only runs on an explicitmpm cleanup --orphans.Distinct from
meta_package_manager.manager.PackageManager.remove_orphan(), which is scoped to one package’s own orphaned dependencies. As withcleanup(), mpm builds no dependency graph: the manager decides what is orphaned.A manager with no native sweep verb is backfilled by this base implementation when it supports both the
orphansquery and package removal: list the orphans, remove each one (withremove_orphan()when available, so every listed root takes its own now-orphaned subtree along), then re-query and repeat until the listing settles, since removing an orphan can orphan its own dependencies. The exact pattern of the synthesized fullupgrade --all, and the in-process equivalent of Arch’s classicpacman -Rns $(pacman -Qtdq)idiom. The re-query loop stops as soon as a round makes no progress, so removal failures cannot spin it forever.A manager implementing neither a native sweep nor the
orphansquery propagatesNotImplementedError, andmpm cleanup --orphanssimply skips it.- Return type:
- cli_names: tuple[str, ...] = ('decomposedcleanupfakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'decomposedcleanupfakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'DecomposedCleanupFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- tests.test_orphans.test_remove_orphans_falls_back_to_plain_removal(invoke, removable_fake_pool)[source]¶
remove --orphanswithout a cascade verb removes the package only.It narrates the skip at
INFOand still exits cleanly.
- tests.test_orphans.test_cleanup_orphans_reports_the_sweep(invoke, changing_fake_pool)[source]¶
The trail counts the packages the sweep removed, and the report names them.
- tests.test_orphans.test_cleanup_category_selection(invoke, patch_pool_with, manager_class, args, expected_calls)[source]¶
The tri-state category flags compose, whatever cleanup steps a manager has.
Those steps can be an orphan and a cache category, a cache category alone, or a sweep it can only synthesize from its orphan listing and its removal.
- tests.test_orphans.test_cleanup_trail_names_categories(invoke, patch_pool_with)[source]¶
The trail line of a manager names the categories dispatched to it.
- tests.test_orphans.test_cleanup_all_categories_skipped_errors(invoke, patch_pool_with)[source]¶
Skipping every default category is a usage error, not a silent no-op.
--skip-orphansis not needed, as orphans is not in the default set.
- class tests.test_orphans.ReasonKeepingFakeManager[source]¶
Bases:
FakeManagerFake manager that keeps the install reason of a package it reinstalls.
It keeps the dependency install reason, and has a command changing only that reason.
Its
installedlisting holdsfake-pkg-alpha, and its search finds any package, so a plainmpm installreaches it.Initialize
cli_errorslist.- search(query, extended, exact)[source]¶
Search packages available for install.
There is no need for this method to be perfect and sensitive to
extendedandexactparameters. If the package manager is not supporting these kind of options out of the box, just returns the closest subset of matching package you can come up with. Finer refiltering will happens in themeta_package_manager.manager.PackageManager.refiltered_search()method below.Optional. Will be simply skipped by mpm if not implemented.
- install(package_id, version=None)[source]¶
Install one package and one only.
Allows a specific
versionto be provided.
- mark_explicit(package_id)[source]¶
Record an installed package as explicitly installed.
Some managers keep the dependency install reason of a package that they are asked to install again. Their orphan sweep can then remove a package the user asked for, through
cleanup_orphan()orremove_orphan(). After a successful install of a package thatmay_hold_as_dependency()reported,mpm installandmpm restorerun the manager’s command that changes only the install reason (pacman --database --asexplicit,apt-mark manual,dnf mark install, …).The command must also succeed for a package that is already explicit. A failure does not fail the install:
mpmlogs a warning instead.Optional. A manager whose install already records the package as explicit, or that has no such command, leaves it unimplemented.
- cli_names: tuple[str, ...] = ('reasonkeepingfakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'reasonkeepingfakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'ReasonKeepingFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- class tests.test_orphans.FailingMarkFakeManager[source]¶
Bases:
ReasonKeepingFakeManagerFake manager whose install reason command fails.
Initialize
cli_errorslist.- mark_explicit(package_id)[source]¶
Record an installed package as explicitly installed.
Some managers keep the dependency install reason of a package that they are asked to install again. Their orphan sweep can then remove a package the user asked for, through
cleanup_orphan()orremove_orphan(). After a successful install of a package thatmay_hold_as_dependency()reported,mpm installandmpm restorerun the manager’s command that changes only the install reason (pacman --database --asexplicit,apt-mark manual,dnf mark install, …).The command must also succeed for a package that is already explicit. A failure does not fail the install:
mpmlogs a warning instead.Optional. A manager whose install already records the package as explicit, or that has no such command, leaves it unimplemented.
- cli_names: tuple[str, ...] = ('failingmarkfakemanager',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- documentation_url: str | None = None¶
Entry point of the project’s own documentation, or
Nonewhen it has none.The manual, the documentation site, or the man page of the CLI
mpmdrives: whichever page a user reads to learn the commands this manager wraps. Listed betweenhomepage_urlandrepository_urlin the links of the manager’s page, so a reader reaching for the tool’s reference finds it in the box of facts rather than in the prose below it.Left unset where a link would state a fact twice or invent one: a tool documenting itself in its repository alone, whose README
repository_urlalready reaches. A page about the ecosystem rather than the tool does not qualify either.Where a project’s only site is its manual, that address belongs here and
homepage_urlstays unset: the slot names what the page is, and a reader reaching for the reference looks under the documentation link.Never inherited, like every other link: the AUR helpers extending
pacmaneach document themselves.
- homepage_url: str | None = None¶
Home page of the project, only used in documentation for reference.
Left unset when the home page is the project’s repository, which
repository_urlnames on its own, and when it is the project’s manual, whichdocumentation_urlnames. Never inherited, like the other links.
- id: str = 'failingmarkfakemanager'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- name: str = 'FailingMarkFakeManager'¶
Return package manager’s common name.
Default value is based on class name.
- repository_url: str | None = None¶
Repository holding the project’s code, or
Nonewhen it has no public one.Linked from the manager’s documentation page. Also what the weekly metrics sample reads:
docs/docs_update.pywrites it into the[tool.repomatic.metrics] subjectsofpyproject.tomlwhen its forge answers the sampler, through a mirror for a forge that does not.Never inherited, for the same reason as
wikipedia_url: the AUR helpers extendingpacmaneach live in a repository of their own.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- wikipedia_url: str | None = None¶
English Wikipedia article about the project, or
Nonewhen it has none.Listed last in the links of the manager’s documentation page. The article covers the project that home page names, or is a redirect Wikipedia keeps under the project’s name, landing on the part of a broader article that describes it:
Cargo_(software)opens the Cargo section of the Rust article. An article that merely mentions the project does not count, nor does one about a related subject:lazyis a Neovim plugin manager, and the Neovim article is not about it.Never inherited: the metaclass resets it to
Noneon any class not declaring its own. A subclass often wraps a distinct project, like the six AUR helpers extendingpacman, and would otherwise present pacman’s article as its own. Documentation-only, likehomepage_url.
- tests.test_orphans.test_install_marks_an_installed_package_explicit(invoke, patch_pool_with)[source]¶
- tests.test_orphans.test_install_leaves_a_fresh_package_alone(invoke, patch_pool_with)[source]¶
A fresh install is explicit already: no reason command runs.
- tests.test_orphans.test_install_survives_a_failed_mark(invoke, patch_pool_with)[source]¶
The package is installed even when its reason cannot change: warn only.