feat(02-02): implement ESP32Transport UDP client with asyncio DatagramProtocol

- ESP32Transport.send_command() injects v:1, fire-and-forget, silent drop if not ready
- 512-byte payload limit enforced with warning log
- datagram_received() parses STATUS ok → connected=True, stores last_status
- on_status callback support for status update notifications
- connection_lost() sets connected=False, clears transport ref
- create_esp32_transport() async factory sends initial STATUS ping (D-12)
- All protocol behaviors match docs/protocol.md exactly (D-10, D-11, D-12, D-14)
- Add pytest-asyncio to dev deps + asyncio_mode=auto for test suite
This commit is contained in:
Claude
2026-04-03 14:19:20 +02:00
parent f10fcf016e
commit 378620e0bb
11 changed files with 898 additions and 0 deletions

33
tests/test_scaffold.py Normal file
View File

@@ -0,0 +1,33 @@
"""TDD RED: Tests for project scaffold — these must fail before implementation."""
import subprocess
import sys
def test_led_sync_importable():
"""led_sync package must be importable with a __version__ attribute."""
result = subprocess.run(
["uv", "run", "python", "-c", "import led_sync; print(led_sync.__version__)"],
capture_output=True,
text=True,
cwd="/home/claude/keineahnungirgendeintesthalt",
)
assert result.returncode == 0, f"Import failed: {result.stderr}"
assert result.stdout.strip(), "No version printed"
def test_core_dependencies_importable():
"""All Phase 2 core deps must be importable."""
result = subprocess.run(
[
"uv",
"run",
"python",
"-c",
"import miniaudio, sounddevice, numpy, pydantic; print('OK')",
],
capture_output=True,
text=True,
cwd="/home/claude/keineahnungirgendeintesthalt",
)
assert result.returncode == 0, f"Dependency import failed: {result.stderr}"
assert "OK" in result.stdout