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_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-ageexpects 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_MANAGERShelp text reads this for every manager, so it must never shell out toyay --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, notweakref.finalize(self, ...): yay re-readsinit.luamid-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.
versionrunsyay --versionthroughrun(), which injectscooldown_env(), which consultssupports_cooldown->version. The re-entrancy guard must break that loop. Regression for a liveRecursionErrorthe pre-seeded-version tests above could not catch.
- 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_flatpak_release_date_probes_every_remote_for_a_new_app(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 Modifiedfield.A repository package is exempt, and an answer with no readable date dates nothing.
- tests.test_cooldown.test_paru_gated_upgrade_all_rides_the_ignore_flag(monkeypatch)[source]ΒΆ
Held AUR packages are excluded from the single
--sysupgradetransaction.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
currentVersionReleaseDateof the catalog record.mas lookupprints that record. The date isNonewhen the record holds no readable date.
- tests.test_cooldown.test_cooldown_permits_allows_off(caplog)[source]ΒΆ
offexempts a manager from the gate entirely, like best-effort.
- tests.test_cooldown.test_off_policy_suppresses_env_injection()[source]ΒΆ
An
offpolicy holds back the cutoff even where a manager could honor it.
- tests.test_cooldown.test_cooldown_option_parses_windows_and_keywords(raw, expected)[source]ΒΆ
The
--cooldownunion spells a window or an enforcement posture.
- 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.