"""Proves the toolchain works before any real code exists.""" import subprocess import sys from pathlib import Path def test_python_version_matches_space_runtime(): assert sys.version_info[:2] == (3, 12), ( "ZeroGPU provides only Python 3.10.13 and 3.12.12; this project pins 3.12.12" ) def test_package_importable(): import japanese_avatar assert japanese_avatar.__version__ def test_ruff_and_pytest_configured(): import tomllib cfg = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8")) assert cfg["tool"]["ruff"]["target-version"] == "py312" assert "pytest" in cfg["tool"] def test_lfs_armed_before_any_binary_lands(): """Plans 01-01 and 01-04 commit tens of megabytes. A non-LFS push of that size is rejected.""" for path in ("avatar/assets/tutor.vrm", "voicevox/model/zundamon.vvm", "tests/fixtures/x.wav"): out = subprocess.run( ["git", "check-attr", "filter", "--", path], capture_output=True, text=True, check=True ).stdout assert "filter: lfs" in out, f"{path} is not LFS-tracked; see .gitattributes" def test_non_speech_fixtures_exist_and_are_30s(silence_wav, cafe_noise_wav): from tests.conftest import wav_duration_seconds for p in (silence_wav, cafe_noise_wav): assert p.exists(), p assert abs(wav_duration_seconds(p) - 30.0) < 0.01 def test_cafe_noise_is_loud_enough_to_defeat_an_rms_only_gate(cafe_noise_wav): """If this fixture were quiet, plan 01-07's noise-rejection test would pass trivially.""" import wave import numpy as np with wave.open(str(cafe_noise_wav), "rb") as w: pcm = np.frombuffer(w.readframes(w.getnframes()), dtype=" 0.02, "noise fixture too quiet to be a real test"