テストコード(tests/**・test_*.py・conftest.py)を追加・編集するときは本ルールに従うこと.
tests/ 配下に src/sm_tias_lightsim/ のサブパッケージ構造をミラーuv run pytestuv run pytest -m "" --no-strict-markers / デフォルトでスキップは -m "not slow"tests/
├── conftest.py # 共通フィクスチャ
├── fixtures/ # テストデータ(小さい STL / 既知の輝度マップ等)
├── geometry/
│ └── test_loader.py
├── scene/
│ ├── test_builder.py
│ └── test_schema.py
├── render/
│ └── test_runner.py # 軽量シーンの end-to-end
├── test_uniformity.py # MiniTias-Evaluation 互換の数値検証
└── evaluation/
├── test_roi.py
└── test_zones.py
test_<対象モジュール>.pytest_<振る舞い> 例: test_grayscale_conversion_uses_rec709_coefficientsTest<クラス名> で振る舞いごとにグループ化可能uniformity.py, evaluation/zones.py, evaluation/radial.py
scene/schema.py
ValidationError を投げることgeometry/transforms.py(mm ↔ m 等)
scene/builder.py
cli/render.py, cli/evaluate.py)
evaluation/visualize.py)
tmp_path フィクスチャで実ファイルを使うseed を固定するレンダリングを伴うテストは @pytest.mark.slow を付けて区別:
import pytest
@pytest.mark.slow
def test_render_baseline_matches_reference():
...
uv run pytest -m "not slow"uv run pytestマーカー定義は pyproject.toml の [tool.pytest.ini_options] に登録済み.
/implement の流れ:
Phase 2 でテストが書きにくいと感じたら,それは設計が悪いシグナル.Phase 3 でモジュールを分割するか責務を見直す.
seed 固定漏れか,乱数依存の境界値.seed を見直す