CI / test (push) Canceled after 0s
Introduce a frozen Migration handle binding the identity quintet (src/tgt clients, owner, name, NumberMap) the four entity phases previously received as five loose params. The phases now take the handle; migrate_repo builds one and drives all phases with it. Retire RefCtx and the shared _path helper (absorbed into the handle's .path()/.rewrite() accessors), deleting code rather than leaving dead types. migrate_issues_and_prs mutates m.numbers in place (returns None). Add tests/test_phases.py: the previously-untested entity layer is now reachable through the Migration seam (two mock-transport clients + a number map, no network), covering the two-pass issue/PR flow, label/milestone mappings, state-setting, best-effort PR merge, the deleted-branch head fallback, and release+asset re-upload. Closes #2
1.7 KiB
1.7 KiB
tests
Purpose
Pytest suite for codeberg_to_gitea_migrator.
Ownership
Project maintainer (Alexander Kucera).
Local Contracts
- pytest
testpaths = ["tests"](rootpyproject.toml). - Test files named
test_*.py; test functionstest_*.
Work Guidance
test_smoke.py— package imports + version.test_refs.py—#NNN/URL cross-reference rewrite +NumberMap.test_clients.py—ApiClientpagination, param cleaning, 4xx handling, JSON POST, all viahttpx.MockTransport(no network).test_git.py— theGitRunnerseam (auth delivery via non-persistedextraHeader, known-secret redaction, timeout/error contract,oknever raises) + an AST guard that git is invoked only throughGitRunner. Driven by a recording exec fake; no git binary, no network.test_mirror.py— the mirror procedure's ordering invariants (capture → prune → mirror push → PR-head push; LFS gated on the probe) and per-op auth wiring (fetch=source, push=target, local ref ops=none), via a recording exec fake that captures command intent only — never the token.test_phases.py— all four entity phases (labels, milestones, issues+PRs two-pass, releases) driven through theMigrationseam: twohttpx.MockTransport-backed clients + aNumberMap, asserting the paths/bodies the target received and the resulting number-map state. Covers ref rewriting, state-setting, best-effort PR merge (409 tolerated), the deleted-branch_pr/<n>head fallback, and the 404-releases skip. No network.- Keep tests network-free: never hit live Codeberg/Gitea from the suite. The end-to-end run is a manual CLI invocation, not a test.
Verification
pytestfrom the repo root.
Child DOX Index
- No children.