Full rearchitecture using Claude
- event bus systen - all components are independent - preparation for web frontend
This commit is contained in:
39
python-backend/tests/conftest.py
Normal file
39
python-backend/tests/conftest.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
VALID_CONFIG: dict[str, Any] = {
|
||||
"general": {
|
||||
"figure_folder": "music",
|
||||
"serial_port": "/dev/ttyUSB0",
|
||||
"min_volume": 0,
|
||||
"max_volume": 60,
|
||||
"initial_volume": 40,
|
||||
},
|
||||
"figures": {
|
||||
"fuchs": {"id": "04a1b2c3d4", "colors": ["#ff6600", "#ffcc00", "#331100", "wff"]},
|
||||
"eule": {"id": "04b2c3d4e5", "colors": ["#3355ff", "#66aaff", "#001133", "#ffffff"]},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config_dir(tmp_path: Path) -> Path:
|
||||
"""A directory with a valid ``music/`` tree and two figures' worth of tracks."""
|
||||
for figure, tracks in (("fuchs", 3), ("eule", 2)):
|
||||
folder = tmp_path / "music" / figure
|
||||
folder.mkdir(parents=True)
|
||||
for index in range(tracks):
|
||||
(folder / f"{index:02d} - track.mp3").write_bytes(b"")
|
||||
return tmp_path
|
||||
|
||||
|
||||
def write_config(directory: Path, data: dict[str, Any], name: str = "config.yml") -> Path:
|
||||
path = directory / name
|
||||
with path.open("w", encoding="utf-8") as handle:
|
||||
YAML(typ="safe").dump(data, handle)
|
||||
return path
|
||||
Reference in New Issue
Block a user