refactor: flatten Faust work to the repo root
Move works/faust/{work.toml,data,annotations,assets} to the root and the
generated project vn/faust/ to vn/. Update ignore patterns and add the Faust
integration tests (real text, e2e playthrough) reading the new paths.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No files matched your search
@@ -6,17 +6,17 @@ __pycache__/
|
|||||||
dist/
|
dist/
|
||||||
.env
|
.env
|
||||||
# Raw downloads are cached locally and re-fetched on demand
|
# Raw downloads are cached locally and re-fetched on demand
|
||||||
works/*/data/raw/
|
data/raw/
|
||||||
# Ren'Py runtime artifacts
|
# Ren'Py runtime artifacts
|
||||||
vn/*/game/**/*.rpyc
|
vn/game/**/*.rpyc
|
||||||
vn/*/game/**/*.rpymc
|
vn/game/**/*.rpymc
|
||||||
vn/*/game/cache/
|
vn/game/cache/
|
||||||
vn/*/game/saves/
|
vn/game/saves/
|
||||||
vn/*/log.txt
|
vn/log.txt
|
||||||
vn/*/game/log.txt
|
vn/game/log.txt
|
||||||
vn/*/traceback.txt
|
vn/traceback.txt
|
||||||
vn/*/errors.txt
|
vn/errors.txt
|
||||||
vn/*/lint.txt
|
vn/lint.txt
|
||||||
# Local Ren'Py SDK and builds
|
# Local Ren'Py SDK and builds
|
||||||
/tools
|
/tools
|
||||||
build/
|
build/
|
||||||
@@ -25,5 +25,5 @@ build/
|
|||||||
.claude/worktrees/
|
.claude/worktrees/
|
||||||
.mcp.json
|
.mcp.json
|
||||||
# Original generated images are large; final processed assets are committed instead
|
# Original generated images are large; final processed assets are committed instead
|
||||||
works/*/assets/raw/
|
assets/raw/
|
||||||
vn/*/progressive_download.txt
|
vn/progressive_download.txt
|
||||||
|
Before Width: | Height: | Size: 367 KiB After Width: | Height: | Size: 367 KiB |
|
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
|
Before Width: | Height: | Size: 387 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 351 KiB |
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 398 KiB |
|
Before Width: | Height: | Size: 432 KiB After Width: | Height: | Size: 432 KiB |
|
Before Width: | Height: | Size: 387 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
@@ -0,0 +1,38 @@
|
|||||||
|
"""End-to-end playthrough of the generated Faust project (needs the Ren'Py SDK)."""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from vnpipe import renpy_gen
|
||||||
|
from vnpipe.config import load_work
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
SDK = Path(os.environ.get("RENPY_SDK") or ROOT / "tools/renpy-sdk") / "renpy.sh"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not SDK.exists(), reason="Ren'Py SDK not found (set RENPY_SDK)")
|
||||||
|
def test_e2e_playthrough_faust(tmp_path):
|
||||||
|
work = load_work(ROOT)
|
||||||
|
data = json.loads((ROOT / "data/annotated.json").read_text(encoding="utf-8"))
|
||||||
|
out = tmp_path / "faust"
|
||||||
|
renpy_gen.generate(work, data, out, with_test=True)
|
||||||
|
home = tmp_path / "home"
|
||||||
|
home.mkdir()
|
||||||
|
env = {
|
||||||
|
**os.environ,
|
||||||
|
"HOME": str(home),
|
||||||
|
"SDL_VIDEODRIVER": "dummy",
|
||||||
|
"SDL_AUDIODRIVER": "dummy",
|
||||||
|
"RENPY_RENDERER": "sw",
|
||||||
|
}
|
||||||
|
result = subprocess.run(
|
||||||
|
[str(SDK), str(out), "test"], capture_output=True, text=True, env=env, timeout=900
|
||||||
|
)
|
||||||
|
report = result.stdout + result.stderr
|
||||||
|
for name in ("traceback.txt", "errors.txt"):
|
||||||
|
assert not (out / name).exists(), (out / name).read_text(encoding="utf-8")
|
||||||
|
assert result.returncode == 0, report
|
||||||
|
assert "Traceback" not in report and "FAIL" not in report, report
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
"""Faust-specific checks on the real text and the committed data."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from vnpipe import renpy_gen, text
|
||||||
|
from vnpipe.config import load_work
|
||||||
|
from vnpipe.schema import validate
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
RAW = ROOT / "data/raw/pg68566.txt"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not RAW.is_file(), reason="raw Gutenberg file not downloaded")
|
||||||
|
def test_real_file_integration():
|
||||||
|
work = load_work(ROOT)
|
||||||
|
_, parsed = text.build(RAW.read_bytes(), work.data)
|
||||||
|
assert [s["id"] for s in parsed["scenes"]] == [
|
||||||
|
"dedicatoria",
|
||||||
|
"prologo_teatro",
|
||||||
|
"prologo_cielo",
|
||||||
|
"noche",
|
||||||
|
]
|
||||||
|
known = set(work.speakers.values())
|
||||||
|
for s in parsed["scenes"]:
|
||||||
|
assert s["lines"]
|
||||||
|
assert {ln["speaker"] for ln in s["lines"]} - {None} <= known
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not RAW.is_file(), reason="raw Gutenberg file not downloaded")
|
||||||
|
def test_cli_parse_is_byte_identical(tmp_path):
|
||||||
|
work_dir = tmp_path / "faust"
|
||||||
|
(work_dir / "data/raw").mkdir(parents=True)
|
||||||
|
shutil.copy(ROOT / "work.toml", work_dir / "work.toml")
|
||||||
|
shutil.copy(RAW, work_dir / "data/raw/pg68566.txt")
|
||||||
|
args = argparse.Namespace(work=work_dir)
|
||||||
|
assert text.cmd_parse(args) == 0
|
||||||
|
first = (work_dir / "data/parsed.json").read_bytes()
|
||||||
|
assert text.cmd_parse(args) == 0
|
||||||
|
assert (work_dir / "data/parsed.json").read_bytes() == first
|
||||||
|
assert first.endswith(b"\n")
|
||||||
|
assert (work_dir / "data/play.txt").read_text(encoding="utf-8").startswith("DEDICATORIA\n")
|
||||||
|
# the committed data is what the parser produces
|
||||||
|
assert first == (ROOT / "data/parsed.json").read_bytes()
|
||||||
|
|
||||||
|
|
||||||
|
def test_from_parsed_annotations():
|
||||||
|
work = load_work(ROOT)
|
||||||
|
parsed = json.loads((ROOT / "data/parsed.json").read_text(encoding="utf-8"))
|
||||||
|
annotated = renpy_gen.annotations_from_parsed(work, parsed)
|
||||||
|
validate(annotated, "annotated")
|
||||||
|
teatro = next(s for s in annotated["scenes"] if s["id"] == "prologo_teatro")
|
||||||
|
stage = [ln["ann"]["on_stage"] for ln in teatro["lines"] if ln["kind"] == "verse"]
|
||||||
|
assert stage[0] == [{"character": "director", "position": "left"}]
|
||||||
|
assert {e["character"]: e["position"] for e in stage[-1]} == {
|
||||||
|
"director": "left",
|
||||||
|
"poet": "right",
|
||||||
|
"clown": "center",
|
||||||
|
}
|
||||||
|
dedication = annotated["scenes"][0]["lines"][0]["ann"]
|
||||||
|
assert dedication["speaker"] == "poet_voice" and dedication["on_stage"] == []
|
||||||
|
cielo = next(s for s in annotated["scenes"] if s["id"] == "prologo_cielo")
|
||||||
|
assert cielo["lines"][0]["ann"]["on_stage"] == []
|
||||||
|
# the real project generates (cues all resolve) without writing anything
|
||||||
|
renpy_gen.render_script(work, annotated, set())
|
||||||
|
|
||||||
|
|
||||||
|
def test_annotated_data_is_valid():
|
||||||
|
data = json.loads((ROOT / "data/annotated.json").read_text(encoding="utf-8"))
|
||||||
|
validate(data, "annotated")
|
||||||
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 81 B After Width: | Height: | Size: 81 B |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 97 B After Width: | Height: | Size: 97 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 97 B After Width: | Height: | Size: 97 B |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 81 B After Width: | Height: | Size: 81 B |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |