tests.test_version_sync moduleΒΆ
Tests for the self-hosted version-sync foundation.
- tests.test_version_sync.test_select_latest_respects_cooldown()[source]ΒΆ
The highest version that has cleared the cooldown wins.
- tests.test_version_sync.test_select_latest_excludes_the_cutoff_day_itself()[source]ΒΆ
A release dated exactly on the cutoff is held back, not adopted.
Datasources report a release date while uv enforces
--exclude-newerat instant granularity, so a release published on the cutoff day may still be younger thannow - min_age. Adopting it pins a version uv then refuses to resolve. This is the shape that broke every binary build: a run at05:20UTC took a release published at17:07on the cutoff date.
- tests.test_version_sync.test_cooldown_boundary_partitions_cleanly(offset_days, adopted)[source]ΒΆ
select_latestandselect_held_backnever both take, nor both drop.
- tests.test_version_sync.test_pin_inside_cooldown(offset_days, flagged)[source]ΒΆ
A pin already on disk is judged by the predicate that would write it.
- tests.test_version_sync.test_pin_inside_cooldown_stays_quiet_on_unknowns()[source]ΒΆ
A pin the datasource does not offer, or dates badly, is never flagged.
- tests.test_version_sync.test_set_with_package_version_does_not_match_a_name_prefix()[source]ΒΆ
mdformatmust not swallow themdformat-gfmpin sitting next to it.
- tests.test_version_sync.test_find_workflow_literals_npm_commands(command, package, version)[source]ΒΆ
Both npm and npx pins are discovered, whatever flags sit in between.
- tests.test_version_sync.test_find_workflow_literals_ignores_unpinned_npm(command)[source]ΒΆ
A command naming no version has no literal to walk forward.
- tests.test_version_sync.test_apply_workflow_literals_self_pin_exemption(content, expected)[source]ΒΆ
- tests.test_version_sync.test_apply_workflow_literals_leaves_other_packages_unexempted()[source]ΒΆ
Only the self-pin bypasses the cooldown, so only it earns the flag.
- tests.test_version_sync.test_find_upstream_ref_pins_carries_the_sha()[source]ΒΆ
A tag-only ref yields a
NoneSHA, whichinitβs floor must not invent.
- tests.test_version_sync.test_sync_action_pins_pr_body_has_cutoff_held_back_and_notes(tmp_path, monkeypatch)[source]ΒΆ
The sync-action-pins PR body carries the cutoff, held-back, and notes.
Locks the gap PR 2827 surfaced: the three version-sync updaters must render the same cooldown cutoff line,
Held back by cooldownsection, andRelease notesdropdown that sync-uv-lock already does. Fixture release dates are derived from the current date so the cooldown windows stay valid whenever the test runs.
- tests.test_version_sync.test_sync_action_pins_converges_mixed_pins_without_eligible_upgrade(tmp_path, monkeypatch)[source]ΒΆ
Stragglers converge onto the highest pin when no upgrade qualifies.
Locks the gap kdeldycke/extra-platforms#600 surfaced: with one action pinned at two versions, the repo-wide maximum masked the older pins, so the held-back table claimed the action was locked at the highest version while stale pins stayed on disk. The stragglers must be rewritten to the winning pinβs SHA without any tag resolution, even when the only newer release is still inside the cooldown.
- tests.test_version_sync.test_sync_action_pins_merges_mixed_pins_onto_widest_range(tmp_path, monkeypatch)[source]ΒΆ
Mixed pins bumping to one release report a single widest-range row.
With one action pinned at two versions and an eligible release above both, per-file reporting used to emit one table row per starting version, while the slug-keyed compare-URL and release-notes mappings kept a single arbitrary range (the last one, after sorting), so rows linked to compare URLs that contradicted their own text. The merged row must span from the lowest pin and its release notes must cover every release any pin skips.
- tests.test_version_sync.test_sync_workflow_pins_release_notes_cover_pypi_literals_only(tmp_path, monkeypatch)[source]ΒΆ
sync-workflow-pins --release-notesfetches notes for PyPI pins only.npm literals have no source-discovery path, so they are excluded from the
fetch_release_notescall even when bumped in the same run, while the PyPI literalβs notes still render.
- tests.test_version_sync.test_sync_workflow_pins_upstream_pin_aligns_to_refs_in_cooldown(tmp_path, monkeypatch)[source]ΒΆ
The upstream toolkit pin aligns to the
uses:ref despite the cooldown.A fresh upstream release is normally withheld by
minimum-release-age, which left the inline pin lagging the already-bumped refs andlint-repofailing until the cooldown expired. Regular literals in the same run stay cooldown-governed.
- tests.test_version_sync.test_sync_workflow_pins_upstream_pin_cooldown_without_refs(tmp_path, monkeypatch)[source]ΒΆ
Without upstream
uses:refs, the toolkit pin stays cooldown-governed.
- tests.test_version_sync.test_sync_workflow_pins_upstream_pin_already_aligned(tmp_path, monkeypatch)[source]ΒΆ
A pin equal to the
uses:ref version ignores newer PyPI releases.
- tests.test_version_sync.test_sync_workflow_pins_upstream_pin_realigns_stragglers_both_ways(tmp_path, monkeypatch)[source]ΒΆ
Every literal realigns to the refs, lagging or ahead, across files.
- tests.test_version_sync.test_registry_tool_has_resolvable_datasource(name)[source]ΒΆ
Every registry tool resolves a datasource so sync-tool-versions covers it.
- tests.test_version_sync.test_registry_tag_pattern_is_valid(name)[source]ΒΆ
A
tag_pattern, when set, compiles and exposes aversiongroup.
- tests.test_version_sync.test_every_simple_action_pin_is_discoverable()[source]ΒΆ
Every simple
owner/repo@<sha>pin in .github/ is found by the scanner.A pin in a shape
find_action_pinsmisses would letsync-action-pinssilently skip an action. Subpath refs (reusable workflows) and local./refs are excluded by design and asserted absent.
- tests.test_version_sync.CHECKSUM_TABLE = '// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: { [key: string]: string } = {\n "aarch64-apple-darwin-0.12.3":\n "1c99f3af80fdcd2e4b0e2c2c4ba5c3ff2ec0f27a24a2f6b0b8f38ba24bd1c0a1",\n "arm-unknown-linux-musleabihf-0.12.3":\n "2b88e2ae7fecbc1d3a0d1b1b3a94b2ee1db9e16913b1e5a0a7e27a913ac2b0b2",\n "x86_64-unknown-linux-gnu-0.11.30":\n "3a77d19d6edbab0c2909a0a0294a1dd00ca8d05802a0d4909d16909802b3a0c3",\n};\n'ΒΆ
A checksum table in the upstream shape, holding two uv versions.
Both target triples and both segment counts are represented, since the version is the only fixed part of a key:
arm-unknown-linux-musleabihfcarries one more segment thanaarch64-apple-darwin.
- tests.test_version_sync.CHECKSUM_TABLE_JSON = '{\n "aarch64-apple-darwin-0.12.12": "4d66e2bf09b1f5d7a3e6c1e0b2a8f3c7",\n "x86_64-unknown-linux-gnu-0.12.12": "5e77f3c01ac2a6e8b4f7d2f1c3b9a4d8"\n}\n'ΒΆ
A table in the JSON layout
setup-uvadopted inv10.1.0, digests shortened.
- tests.test_version_sync.CHECKSUM_TABLE_IMPORT = 'import knownChecksums from "./known-checksums.json" with { type: "json" };\n\nexport const KNOWN_CHECKSUMS: Record<string, string> = knownChecksums;\n'ΒΆ
What the TypeScript file holds from
v10.1.0on: an import, and no key.
- tests.test_version_sync.uncached_table()[source]ΒΆ
Clear the per-commit checksum-table cache around a test.
- tests.test_version_sync.test_checksum_table_parses_every_version(uncached_table)[source]ΒΆ
Each key yields its uv version, whatever the target tripleβs shape.
- tests.test_version_sync.test_checksum_table_reads_the_json_layout(uncached_table)[source]ΒΆ
From
v10.1.0on, the table sits in the JSON file the TypeScript one imports.
- tests.test_version_sync.test_checksum_table_falls_back_to_the_typescript_layout(uncached_table)[source]ΒΆ
A pin older than
v10.1.0has no JSON file, and holds the table inline.
- tests.test_version_sync.test_checksum_table_unreadable_is_unknown(uncached_table)[source]ΒΆ
A failed fetch is unknown, never a table that verifies nothing.
- tests.test_version_sync.test_checksum_table_without_keys_is_unknown(uncached_table)[source]ΒΆ
A body parsing to nothing means the upstream format moved, not that the action verifies nothing.
- tests.test_version_sync.test_checksum_table_is_fetched_once_per_commit(uncached_table)[source]ΒΆ
Content at a commit is immutable, so the two readers share one fetch.
- tests.test_version_sync.test_setup_uv_verified_versions_intersects_every_pin(uncached_table)[source]ΒΆ
Mid-bump, only a uv both pinned tables carry is verifiable fleet-wide.