tests.test_cooldown moduleΒΆ

tests.test_cooldown.test_release_anchored_cutoff_math(cooldown_input, release_iso, should_pass, monkeypatch)[source]ΒΆ

Verify the cooldown cutoff blocks fresh releases and lets older ones pass.

Pattern borrowed from astral-sh/uv#19475: anchor against real upstream release timestamps (idna 3.6 / 3.7 on PyPI) and a frozen β€˜today’ so the arithmetic stays deterministic.

tests.test_cooldown.test_supported_managers_advertise_cooldown(manager_class, env_var)[source]ΒΆ
tests.test_cooldown.test_ungateable_managers_lack_cooldown(manager_class)[source]ΒΆ
tests.test_cooldown.test_timestamp_based_managers_inject_cutoff(manager_class)[source]ΒΆ

Managers whose env var expects an RFC 3339 cutoff timestamp.

tests.test_cooldown.test_npm_injects_integer_days(cooldown, expected_days)[source]ΒΆ

npm’s min-release-age expects an integer count of days, not a timestamp.

tests.test_cooldown.test_yay_advertises_cooldown_while_idle()[source]ΒΆ

While idle, yay reports its structural capability without a version probe.

The import-time COOLDOWN_SUPPORTED_MANAGERS help text reads this for every manager, so it must never shell out to yay --version.

tests.test_cooldown.test_yay_cooldown_version_gate(version, supported)[source]ΒΆ

yay can enforce a cooldown only from v13.0.0, when its Lua hooks landed.

tests.test_cooldown.test_yay_cooldown_undetectable_version()[source]ΒΆ

A yay whose version cannot be parsed cannot enforce a cooldown.

tests.test_cooldown.test_yay_cooldown_policy_gates_both_paths()[source]ΒΆ

The generated policy gates upgrades and installs off the same cutoff.

tests.test_cooldown.test_yay_user_config_dir(env, expected, monkeypatch)[source]ΒΆ

The real config dir follows yay’s own XDG_CONFIG_HOME over HOME precedence.

tests.test_cooldown.test_yay_cooldown_overlay(tmp_path, monkeypatch)[source]ΒΆ

An active cooldown on a recent yay builds a lossless XDG_CONFIG_HOME overlay.

tests.test_cooldown.test_yay_cooldown_overlay_without_user_config(tmp_path, monkeypatch)[source]ΒΆ

With no user config present, the overlay omits the config.json symlink.

tests.test_cooldown.test_yay_cooldown_overlay_survives_manager_gc(tmp_path, monkeypatch)[source]ΒΆ

The overlay must outlive the Yay instance’s garbage collection.

Cleanup is registered with atexit, not weakref.finalize(self, ...): yay re-reads init.lua mid-run, so a GC-tied removal could delete the overlay before yay finishes and silently fail the gate open.

tests.test_cooldown.test_yay_cooldown_epoch_clamped_to_zero(tmp_path, monkeypatch)[source]ΒΆ

A cooldown reaching before 1970 clamps the epoch to 0.

A negative Unix timestamp parses back to nil in yay’s gopher-lua, which silently drops the gate; epoch 0 keeps the floor effective.

tests.test_cooldown.test_yay_cooldown_no_recursion_when_version_resolved_lazily(tmp_path, monkeypatch)[source]ΒΆ

Resolving the version lazily under an active cooldown must not recurse.

version runs yay --version through run(), which injects cooldown_env(), which consults supports_cooldown -> version. The re-entrancy guard must break that loop. Regression for a live RecursionError the pre-seeded-version tests above could not catch.

tests.test_cooldown.test_probe_managers_advertise_synthesized_cooldown(manager_class)[source]ΒΆ
tests.test_cooldown.test_cooldown_is_synthesized_classifier()[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_probe_backed_manager()[source]ΒΆ
tests.test_cooldown.test_hold_inactive_without_cooldown(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_passes_aged_release(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_dates_fresh_release(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_fail_closed_on_unknown_date(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_fail_closed_on_probe_error(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_best_effort_waives_unknown_date(monkeypatch, caplog)[source]ΒΆ
tests.test_cooldown.test_hold_off_policy_skips_probe(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_dry_run_skips_probe(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_naive_datetime_read_as_utc(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_hold_probes_each_package_once(monkeypatch)[source]ΒΆ

A verdict is reused whatever it says: held, cleared or undatable.

tests.test_cooldown.test_synthesized_gate_reroutes_upgrade_all(monkeypatch)[source]ΒΆ

An active probe-backed cooldown takes the per-package upgrade path.

It replaces the native one-shot upgrade: eligible packages upgrade, too-fresh ones are held.

tests.test_cooldown.test_upgrade_all_without_cooldown_keeps_native_path(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_flatpak_release_date_reads_installed_origin(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_flatpak_release_date_probes_every_remote_for_a_new_app(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_flatpak_release_date_none_without_date_line(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_paru_release_date(stub_run_cli, package_id, output, expected)[source]ΒΆ

An AUR package is dated by its Last Modified field.

A repository package is exempt, and an answer with no readable date dates nothing.

tests.test_cooldown.test_hold_passes_exempt_sentinel(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_paru_gated_upgrade_all_rides_the_ignore_flag(monkeypatch)[source]ΒΆ

Held AUR packages are excluded from the single --sysupgrade transaction.

They do not reroute to per-package upgrades.

tests.test_cooldown.test_paru_gated_upgrade_all_without_holds_keeps_native_cli(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_gated_upgrade_all_of_a_user_directory_goes_one_by_one(monkeypatch, tmp_path)[source]ΒΆ

A user install directory keeps out the native upgrade, even one with exclusions.

Only the packages of that directory upgrade, one by one, and the held one waits.

tests.test_cooldown.test_mas_release_date(capture_run_cli, output, expected)[source]ΒΆ

The release date is the currentVersionReleaseDate of the catalog record.

mas lookup prints that record. The date is None when the record holds no readable date.

tests.test_cooldown.test_attempt_install_reports_cooldown_status(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_package_task_holds_fresh_release(monkeypatch)[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_without_cooldown()[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_supported_manager()[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_blocks_ungateable(caplog)[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_allows_best_effort(caplog)[source]ΒΆ
tests.test_cooldown.test_cooldown_permits_allows_off(caplog)[source]ΒΆ

off exempts a manager from the gate entirely, like best-effort.

tests.test_cooldown.test_off_policy_suppresses_env_injection()[source]ΒΆ

An off policy holds back the cutoff even where a manager could honor it.

tests.test_cooldown.test_cli_rejects_invalid_cooldown(invoke)[source]ΒΆ
tests.test_cooldown.test_cooldown_option_parses_windows_and_keywords(raw, expected)[source]ΒΆ

The --cooldown union spells a window or an enforcement posture.

tests.test_cooldown.test_parse_cooldown_section(section, expected)[source]ΒΆ
tests.test_cooldown.test_parse_cooldown_section_rejects(section, reason)[source]ΒΆ
tests.test_cooldown.test_parse_cooldown_section_rejects_wrong_shape()[source]ΒΆ

A section that is neither a table nor a string is a type error.

tests.test_cooldown.test_format_period_round_trips(window, spelling)[source]ΒΆ

A window takes its largest whole unit, and parses back unchanged.

tests.test_cooldown.test_resolve_cooldown(flag, settings, expected)[source]ΒΆ

The flag and the configuration merge axis by axis.

tests.test_cooldown.test_cli_cooldown_config_table(tmp_path, invoke)[source]ΒΆ

A [mpm.cooldown] table reaches the gate through the configuration.

tests.test_cooldown.test_cli_cooldown_keyword_without_window_is_a_noop(invoke)[source]ΒΆ

A posture keyword with no window anywhere logs an INFO note.

tests.test_cooldown.test_cli_cooldown_legacy_config_spelling(tmp_path, invoke)[source]ΒΆ

The deprecated top-level string still sets the window, with a warning.

tests.test_cooldown.test_cli_cooldown_config_policy_without_period(tmp_path, invoke)[source]ΒΆ

A standing posture without a window is rejected at load time.