tests.test_uv module¶
Tests for the audit command (read-only report by default, --fix to
upgrade) and the repomatic.deps.uv lock helpers behind the
exclude-newer-package cooldown-bypass lifecycle.
The repomatic.deps.dep_report renderers these helpers feed are covered by
tests/test_dep_report.py’s golden renders.
- tests.test_uv.test_cooldown_windows_match_minimum_release_age()[source]¶
The lock window and the install window are the same duration.
[tool.uv] exclude-newergatesuv lock, while [tool.repomatic] minimum-release-age``gates the``uvx installs every workflow runs. A lock window wider than the install window resolves versions those installs then refuse, leaving a package pinned inuv.lockthat CI cannot install. Keeping the two literals equal closes that band.- Return type:
- tests.test_uv.default_config(monkeypatch)[source]¶
Pin the command to dataclass-default config, independent of the repo.
- tests.test_uv.no_github_repo(monkeypatch)[source]¶
Drop GITHUB_REPOSITORY so –repo defaults to empty (CI sets it).
- tests.test_uv.test_audit_report_lists_vulnerabilities_and_exits_nonzero(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_audit_report_clean_exits_zero(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_audit_exit_zero_overrides_findings(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_audit_report_does_not_call_the_fix_engine(monkeypatch, default_config, no_github_repo)[source]¶
Report mode is read-only: it must never reach the upgrade path.
- tests.test_uv.test_audit_output_writes_markdown(monkeypatch, default_config, no_github_repo, tmp_path)[source]¶
- tests.test_uv.test_audit_drops_github_source_without_repo(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_audit_fix_delegates_to_engine(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_audit_fix_no_fixable_exits_zero(monkeypatch, default_config, no_github_repo)[source]¶
- tests.test_uv.test_prune_stale_exclude_newer_packages_returns_pruned_names(tmp_path)[source]¶
An entry whose held version aged past the cutoff is dropped by name.
- tests.test_uv.test_prune_stale_exclude_newer_packages_keeps_active_freeze(tmp_path)[source]¶
A freeze whose held version is still inside the window stays put.
- tests.test_uv.YESTERDAY = 'yesterday'¶
Stands for a cutoff one day old, resolved in the test body.
A timestamp computed at collection differs between xdist workers.
- tests.test_uv.test_prune_ages_an_entry_the_lock_does_not_hold_by_its_cutoff(tmp_path, entry, packages, pruned)[source]¶
A package outside the lock has no held version, so its cutoff ages.
Once the rolling cutoff has passed a fixed timestamp, the entry admits no release the cooldown still withholds, and it blocks every later one.
- tests.test_uv.test_prune_matches_a_lock_name_in_any_spelling(tmp_path)[source]¶
An entry keyed by another spelling of the name still finds its release.
- tests.test_uv.test_prune_leaves_a_comment_naming_the_pruned_entry(tmp_path)[source]¶
A partial prune keeps the table’s comment, which still names the entry.
- tests.test_uv.test_bypass_comment_mentions(tmp_path, uv_lines, names, expected)[source]¶
Only the comments attached to
exclude-newer-packageare searched.
- tests.test_uv.test_freeze_exclude_newer_packages_returns_frozen_names(tmp_path)[source]¶
A relative-span bypass is rewritten to hold the locked version.
- tests.test_uv.test_freeze_exclude_newer_packages_pins_bare_date(tmp_path)[source]¶
A legacy bare date is pinned to the equivalent explicit UTC instant.
- tests.test_uv.test_freeze_exclude_newer_packages_keeps_span_without_upload_time(tmp_path)[source]¶
A git/path package has no release to freeze against: span kept as-is.
- tests.test_uv.test_freeze_exclude_newer_packages_window_absorbs_same_day_patch(tmp_path)[source]¶
A freeze holds a day-granular window, not a single version.
The cutoff rounds up to the second UTC midnight after the held version’s upload, so a patch released later the same day (or on the next calendar day) stays inside the window and is adopted on the next lock. This is the accepted trade-off documented on
_freeze_cutoff: pinning the cutoff to the exact upload instant is the only way to reject a same-day patch, so locking the window width here makes any such tightening a conscious change.
- tests.test_uv.LOCK_NAME_SPELLINGS = ('lemon-curd', 'lemon_curd', 'Lemon_Curd', 'LEMON-CURD')¶
Spellings of one package name under PEP 503. The first is the one uv locks.
- tests.test_uv.test_freeze_matches_a_lock_name_in_any_spelling(tmp_path, key)[source]¶
A span keyed by another spelling of the name is frozen like any other.
A lookup by the raw key finds no upload time, reads the package as a git or path source, and leaves the span to track the latest release for good. The entry keeps the key the project wrote.
- tests.test_uv.test_add_matches_a_lock_name_in_any_spelling(tmp_path, name)[source]¶
A package added under another spelling of its name gets a freeze cutoff.
A lookup by the raw name finds no upload time, and the entry falls back to the permanent
"0 day"span of a git or path source.
- tests.test_uv.test_outside_cooldown_matches_a_lock_name_in_any_spelling(tmp_path, name)[source]¶
A release that cleared the window needs no exemption in any spelling.
A lookup by the raw name finds no upload time, and the package is exempted like a git or path source.
- tests.test_uv.test_compute_bypass_forecasts_reports_freezes_only(tmp_path)[source]¶
Fixed-timestamp entries get an expiry; spans do not.
- tests.test_uv.test_compute_bypass_forecasts_flags_unreleased_hold(tmp_path)[source]¶
A freeze holding a version with no upload time can only end by release.
- tests.test_uv.test_compute_bypass_forecasts_without_entries(tmp_path)[source]¶
No
exclude-newer-packagetable yields no forecasts.
- tests.test_uv.test_compute_pruned_forecasts_snapshots_cleared_freezes(tmp_path)[source]¶
Pruned entries keep the version and the (past) date the freeze aged out.
- tests.test_uv.test_compute_pruned_forecasts_dates_an_unlocked_entry_by_its_cutoff(tmp_path)[source]¶
A cleared entry of a package outside the lock keeps its cutoff’s expiry.
- tests.test_uv.test_parse_lock_specifiers_isolates_unconditional_declarations()[source]¶
by_mainholds only what a plain install of the project pulls in.A version marker leaves a dependency unconditional; an extra marker moves it to that extra’s box wherever it sits in the expression; a dev group never lands there at all.
- Return type: