Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix(tests): the suite runs on Windows; the timeout method is left to the platform
Soohong Kim6c913de349bf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d83f6a4..febe6f5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the## Unreleased+- **Fix: the test suite runs on Windows.** `pyproject.toml` named pytest-timeout's `signal` method, and Windows has no SIGALRM, so pytest stopped with an internal error before its first test unless `-o timeout_method=thread` was given. The method is now left to pytest-timeout, which takes `signal` where SIGALRM exists (Linux, macOS: unchanged) and `thread` on Windows. Test: `tests/packaging/test_project_metadata.py`.- **Behavior change: `pixel-draw` runs on your Claude subscription first, and on `ANTHROPIC_API_KEY` only without one** — the order `codex` and `grok` keep. When `claude auth status` says Claude Code is signed in with a subscription (`claude.ai` or `oauth_token`), every call — the drawings, the row repairs, the pick — goes through the unmodified `claude` binary in print mode, from an empty directory, with no tool, no session written and no CLAUDE.md, hook, skill, plugin or MCP server loaded, and costs nothing per call: `report.json` says `auth_source: claude-login`, each call's `mode` is `subscription` and its `cost_usd` `0`, its usage kept. The child never sees `ANTHROPIC_API_KEY`, which print mode would use instead of the login. Without a subscription login the run uses the key as before, billed per call and said on stderr; with neither it is refused naming both, before the run folder is made. A login that refuses a call, has expired or has reached its usage limit fails the call; the run never switches to the key on its own. `--batch` is the API's Message Batches and runs on the key even when signed in. An answer the binary continues past the output cap is read whole from every message, not from its `result`, which holds only the last part; one it cannot finish is read as `stop_reason: max_tokens`, so the one redraw one effort lower happens on either route. One call may take up to `SPRITE_GEN_CLAUDE_CALL_TIMEOUT_SECONDS` (1800). When candidates ask at once, none of their requests leaves before the billing line has been printed. `report.json`'s `auth_source` is what the calls ran on by their records, `mixed` (with `auth_sources`) for a run resumed under the other credential. A `--resume` that reads every call back no longer prints the billing line ([pixel-draw](docs/pixel-draw.md#which-credential-a-call-runs-on)).- **Behavior change: every metered call says so on the terminal, and every report names what a call ran on.** How codex is signed in is one reading, `codex_provider.codex_login` (`codex login status`), for the default provider resolution, `gen --provider codex`, the codex facing check and `workflow`: a codex signed in with an API key used to run with no word about it and the workflow called it a subscription; it now prints the per-call charge line before `codex exec` runs, its report records `extra.auth_source: codex-api-key` (`codex-login` on ChatGPT), and `workflow` asks to confirm the API credit. A codex that is not signed in is refused with the reason before it runs. `gen-set` and `video-set` keep each item's output in its log, but a child's billing line and a default provider switch now also print on the terminal as they happen (`base.run_logged`), each `gen-set` row records `auth_source`, and each `video-set` clip result too. `sound` prints the same billing line as every other metered route (it printed its own) and its receipt records `auth_source`. One function reads a provider key from the environment (`base.env_api_key`: a key, none, or a refusal of an empty one) for Anthropic, OpenAI, xAI and ElevenLabs; one function says what to do when xAI rejects a credential (`xai.rejected_fix`), so `gen --provider grok` now gives the same `grok models` refresh as `video`. `workflow` probes a provider once for its images and videos (they share one credential) and asks the API-credit question by that provider's name rather than always about Grok video. Docs: the credential table in the README, grok's `XAI_API_KEY` route in the help and SKILL.md, the sound billing line, `SPRITE_GEN_GEN_TIMEOUT_SECONDS` and `SPRITE_GEN_CLAUDE_READ_TIMEOUT_SECONDS`, and `gen-set --provider` (`codex` or `grok`).- **Tests** — `tests/gen/test_claude_login.py` (the login before the key, the key only without a login, neither refused naming both, a batch on the key without asking the login, an unreadable status refused rather than read as no login, the child's environment without a key or the calling session, a message mapped onto the binary's flags and stdin with its image and schema, the stream-json answer, a cut answer read as max_tokens, a refused or limited login an error and not a switch to the key, no result, a timeout and a missing binary), the subscription, batch and read-back cases in `tests/gen/test_pixel_draw.py`, and `gen.base.env_api_key` in `tests/gen/test_gen.py`; `tests/gen/test_codex_login.py` (ChatGPT, an API key and not signed in; the default resolution, `generate` and `workflow` read the same login; an API-key login announces the charge and records it), `base.run_logged` in `tests/gen/test_gen.py`, the ElevenLabs billing line and key refusals in `tests/audio/test_sound.py`.diff --git a/pyproject.toml b/pyproject.tomlindex f067b86..52f2b11 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -64,11 +64,13 @@ testpaths = ["tests"]# imported by name (`from conftest import run_script`) from every subfolder, so the# tests/ dir must be on sys.path.pythonpath = ["tests"]-# A hung subprocess test must become a named failure, not a silent stall. signal-# method (SIGALRM) is required — thread method cannot interrupt a blocked-# subprocess.wait(). 120s is generous for the extract/compose subprocess tests.+# A hung subprocess test must become a named failure, not a silent stall. 120s is+# generous for the extract/compose subprocess tests. The method is left to+# pytest-timeout, which takes signal (SIGALRM) where the platform has it — Linux and+# macOS, where only signal interrupts a blocked subprocess.wait() — and thread on+# Windows, which has no SIGALRM: naming signal here stopped pytest on Windows before+# its first test.timeout = 120-timeout_method = "signal"# One mark names a test of the real rife-ncnn-vulkan: tests/conftest.py skips it where no RIFE is# reachable, and `scripts/linux_lane.sh --rife-only` runs exactly the marked tests (`-m real_rife`).markers = [diff --git a/tests/packaging/test_project_metadata.py b/tests/packaging/test_project_metadata.pyindex 8e978df..94bccb0 100644--- a/tests/packaging/test_project_metadata.py+++ b/tests/packaging/test_project_metadata.py@@ -44,3 +44,10 @@ def test_readme_names_declared_python_support_and_venv_requirement() -> None:assert f"CPython {minimum}+" in readmeassert "`venv`/`ensurepip`" in readme+++def test_the_test_timeout_leaves_its_method_to_the_platform(pytestconfig) -> None:+ """`timeout_method = "signal"` stopped pytest on Windows, which has no SIGALRM, before its first+ test. Left unset, pytest-timeout takes signal where SIGALRM exists and thread elsewhere."""+ assert pytestconfig.getini("timeout")+ assert not pytestconfig.getini("timeout_method")