Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
ci: the RIFE-less run fails a skip --rife-only will not run, by name
Soohong Kimc888b76a5303
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 51c8d35..0dd035c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,7 +5,8 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the## Unreleased- **Fix: the Linux lane's `--rife-only` runs every test of the real RIFE, not one file.** It ran `tests/video/test_rife.py` alone, while `--rife-unmeasured` skips every test that needs the real `rife-ncnn-vulkan` — so a real-RIFE test in another file (2.43.0's in `tests/video/test_crossfade.py` and `tests/video/test_ghost_screen.py`) was measured by neither run. Such a test now carries one mark, `real_rife` (registered in `pyproject.toml`): `tests/conftest.py` skips the marked tests where `rife.locate()` finds no RIFE, and `scripts/linux_lane.sh --rife-only` runs `pytest -m real_rife` over the whole suite, none skipped. A new real-RIFE test is run by `--rife-only` once it is marked. `docs/release.md` says what each run measures.-- **`tests/release/test_lane_rife_collection.py`** collects the suite twice, once with a stand-in RIFE where `rife.locate()` looks (`SPRITE_GEN_RIFE`, `PATH`, the install root) and once with none: a test the two collections skip or collect differently and that is not marked `real_rife` fails it by name.+- **The lane's RIFE-less run fails a skip that `--rife-only` will not run.** `--rife-unmeasured` runs the suite as `pytest --rife-unmeasured`, where `tests/conftest.py` reads every skip — by a skip mark, in a fixture or the test body, or of a whole file at import: one whose test is not marked `real_rife` fails by name, unless `NOT_RIFE_SKIPS` in the same file names it as skipping for an input the lane does not give (the `SPRITE_GEN_CHROMA_REAL_STILLS` stills). Such a skip would be measured by neither run.+- **`tests/release/test_lane_rife_collection.py`** collects the suite twice, once with a stand-in RIFE where `rife.locate()` looks (`SPRITE_GEN_RIFE`, `PATH`, the install root) and once with none: a test the two collections skip or collect differently and that is not marked `real_rife` fails it by name — a test collected only where RIFE is reachable never reaches the RIFE-less run. It also runs a marked test and each unmarked way to skip without RIFE through `pytest --rife-unmeasured`: the marked one skips, every other fails by name.- **Correction to 2.43.0's cross-fade measure:** "the windows step by half their size, so one lost pixel is counted in up to four of them" holds where the window is an even number of pixels wide. The step is half the width rounded down, so an odd-width window counts one pixel in up to nine. The `rife.crossfade` docstring and `docs/loop-repair.md` section 4 now say "up to four of them (nine where the window is an odd number of pixels wide)". The measure is unchanged.## v2.43.0 - No loop delivers a ghost frame unmeasured; a cross-fade inside one silhouette is named, not judgeddiff --git a/docs/release.md b/docs/release.mdindex 2e9dba0..db8b0d3 100644--- a/docs/release.md+++ b/docs/release.md@@ -17,15 +17,21 @@ GitHub-hosted CI(GitHub Actions)는 쓰지 않는다. 테스트 게이트와 whelavapipe 에서는 첫 업로드에서 죽는다 — 그래서 그런 호스트에서는 RIFE 를 떼어 내되 조용히 건너뛰지는않는다.-실제 rife-ncnn-vulkan 을 돌리는 시험은 `real_rife` 표시 하나로 가려진다(`pyproject.toml` 이 등록하고+실제 rife-ncnn-vulkan 을 돌리는 시험은 `real_rife` 표시를 단다(`pyproject.toml` 이 등록하고,`tests/conftest.py` 가 RIFE 를 못 찾으면 그 표시가 붙은 시험을 건너뛴다). `--rife-unmeasured` 는RIFE 가 닿는 곳이 하나도 없는 상태로 스위트 전체를 돌려 그 시험들이 이 이유로 건너뛰어지고,`--rife-only` 는 `sprite-gen rife install`(그 확인 프레임)과 스위트 전체에서 `real_rife` 가 붙은시험(`pytest -m real_rife`)을 돌린다 — 하나라도 건너뛰거나, 표시된 시험이 없으면 실패다. 그래서 새-실제-RIFE 시험은 표시만 붙이면 `--rife-only` 가 저절로 걷는다. 표시 없이 RIFE 유무에 따라 건너뛰거나-모이는 시험이 생기면 두 실행 어느 쪽도 재지 않게 되므로, `tests/release/test_lane_rife_collection.py` 가-스위트를 RIFE 가 있는 척하는 대역을 둔 채 한 번, 없는 채 한 번 모아 두 결과가 갈리는 시험마다 표시를-요구하고, 없으면 그 시험의 이름을 대고 실패한다.+실제-RIFE 시험은 표시만 붙이면 `--rife-only` 가 저절로 걷는다.++표시 없이 RIFE 가 없을 때 건너뛰거나 모이지 않는 시험은 두 실행 어느 쪽도 재지 않는다. 그래서+`--rife-unmeasured` 는 시험을 `pytest --rife-unmeasured` 로 돌리고, 그 실행에서 건너뛴 것마다 — skip+표시로든, fixture 나 시험 본문에서든, 파일째 import 에서든 — `tests/conftest.py` 가 `real_rife` 표시를+본다. 표시가 없고, 같은 파일의 `NOT_RIFE_SKIPS` 가 RIFE 가 아닌 이유(레인이 주지 않는 입력)로+건너뛴다고 이름 대지도 않았으면, 그 결과를 실패로 바꿔 시험의 이름을 댄다. RIFE 가 없으면 아예 모이지+않는 시험은 그 실행에 보이지 않으므로, `tests/release/test_lane_rife_collection.py` 가 스위트를 RIFE 가+있는 척하는 대역을 둔 채 한 번, 없는 채 한 번 모아, 모이는지나 skip 표시의 판정이 갈리는 시험마다+표시를 요구하고 없으면 그 이름을 대고 실패한다.통과는 커밋 하나의 것이다. 어떤 커밋에서 잰 레인 — 한 번의 exit 0 이든, `--rife-only` 의 exit 0 이든 —은 다른 커밋의 통과가 아니다. 이전 릴리즈나 부모 커밋의 통과를 다음 커밋으로 옮겨 적지 않고, 머지할diff --git a/scripts/linux_lane.sh b/scripts/linux_lane.shindex 8d112fb..ada08cb 100755--- a/scripts/linux_lane.sh+++ b/scripts/linux_lane.sh@@ -24,14 +24,14 @@# never passed over in silence:# --rife-unmeasured "<why>" every gate but RIFE: no `rife install`, and the suite runs with an# empty data directory and no RIFE on PATH, so the tests that need-# the real binary (marked `real_rife`) skip for that stated reason. The-# run ends by naming what it did not measure and exits 3, not 0.+# the real binary (marked `real_rife`) skip for that stated reason;+# any other skip fails the run (`pytest --rife-unmeasured`) unless+# tests/conftest.py names it as not RIFE's. The run ends by naming+# what it did not measure and exits 3, not 0.# --rife-only the RIFE gates alone, on a host where Vulkan works: `rife install`# (its check frame) and every test of the suite marked `real_rife`,-# none of it skipped. The mark is the suite's only RIFE guard-# (tests/conftest.py), so these are the tests `--rife-unmeasured`-# skips for RIFE; tests/release/test_lane_rife_collection.py fails on-# a test RIFE decides that is not marked.+# none of it skipped — the tests `--rife-unmeasured` let skip for RIFE+# (docs/release.md).# A commit has passed the lane when one run exits 0, or when a `--rife-unmeasured` run (exit 3)# and a `--rife-only` run (exit 0) of the same commit both did.set -euo pipefail@@ -152,7 +152,8 @@ test -f "$smoke/run/sprite-sheet-alpha.png"test -f "$smoke/run/manifest.json"step "tests"-.venv/bin/python -m pytest -q+# Without RIFE, a skip of a test not marked real_rife fails unless tests/conftest.py names it.+.venv/bin/python -m pytest -q ${rife_unmeasured:+--rife-unmeasured}if [ -n "$rife_unmeasured" ]; thenecho "linux_lane: every gate but RIFE passed at $sha"diff --git a/tests/conftest.py b/tests/conftest.pyindex eeebc94..a02f6ba 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -4,6 +4,7 @@ import reimport shutilimport subprocessimport sys+from collections.abc import Generatorfrom pathlib import Pathimport pytest@@ -41,10 +42,27 @@ def run_script(name: str, *args: str) -> subprocess.CompletedProcess[str]:)+# Tests that skip where no RIFE is reachable for a reason other than RIFE: an input the lane does not+# give. Named without their parameters. In the lane's RIFE-less run (`pytest --rife-unmeasured`) these+# and the tests marked real_rife may skip; any other skip fails (docs/release.md).+NOT_RIFE_SKIPS = {+ # SPRITE_GEN_CHROMA_REAL_STILLS names model stills, which the repository does not hold.+ "tests/frames/test_chroma_key_relative.py::test_real_still_keys_out_its_painted_border",+}+++def pytest_addoption(parser: pytest.Parser) -> None:+ parser.addoption(+ "--rife-unmeasured",+ action="store_true",+ help="the RIFE-less run of scripts/linux_lane.sh: a skip fails unless its test is marked real_rife "+ "or named in NOT_RIFE_SKIPS (tests/conftest.py)",+ )++def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:- """A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none. The- mark is the only RIFE guard, so the tests it skips are the tests `scripts/linux_lane.sh- --rife-only` runs (`-m real_rife`); tests/release/test_lane_rife_collection.py holds the suite to it."""+ """A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none, and run+ by `scripts/linux_lane.sh --rife-only` (`-m real_rife`)."""marked = [item for item in items if item.get_closest_marker("real_rife")]if not marked:return@@ -57,6 +75,39 @@ def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:item.add_marker(pytest.mark.skip(reason="rife-ncnn-vulkan not installed (SPRITE_GEN_RIFE / PATH / sprite-gen rife install)"))+def _fail_unmeasured_skip(report: pytest.TestReport | pytest.CollectReport, node: pytest.Item | pytest.Collector) -> None:+ """In the lane's RIFE-less run a skip that `--rife-only` will not run fails, by name: neither run would+ measure it. `--rife-only` runs the tests marked real_rife; a skip of any other test, or of a whole+ file, stands only where NOT_RIFE_SKIPS names it. Whatever skipped it: a skip mark, a fixture, the+ test body, the file at import."""+ if not report.skipped or hasattr(report, "wasxfail") or not node.config.getoption("rife_unmeasured", False):+ return+ if node.get_closest_marker("real_rife") or report.nodeid.partition("[")[0] in NOT_RIFE_SKIPS:+ return+ path, line, reason = report.longrepr+ report.outcome = "failed"+ report.longrepr = (+ "skipped where no RIFE is reachable, but not marked real_rife: `scripts/linux_lane.sh --rife-only` "+ f"runs only the marked tests, so neither run measures it\n{path}:{line}: {reason}\n"+ "A test that needs the real rife-ncnn-vulkan is marked `real_rife`; one that skips for another "+ "reason is named in NOT_RIFE_SKIPS (tests/conftest.py)."+ )++[email protected](wrapper=True)+def pytest_runtest_makereport(item: pytest.Item) -> Generator[None, pytest.TestReport, pytest.TestReport]:+ report = yield+ _fail_unmeasured_skip(report, item)+ return report++[email protected](wrapper=True)+def pytest_make_collect_report(collector: pytest.Collector) -> Generator[None, pytest.CollectReport, pytest.CollectReport]:+ report = yield+ _fail_unmeasured_skip(report, collector)+ return report++@pytest.fixturedef fixture_run_dir(tmp_path: Path) -> Path:"""A throwaway copy of the golden fixture run dir."""