"""TDD: Tests for project scaffold — verifying package and dependency availability.""" import subprocess import sys import importlib.util 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. sounddevice requires libportaudio2 system library which may not be available on all dev environments — documented in SUMMARY as requiring `apt install libportaudio2` on Raspberry Pi OS. """ # Test deps that don't require system audio libraries result = subprocess.run( [ "uv", "run", "python", "-c", "import miniaudio, numpy, pydantic, aubio; 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 # Test sounddevice is installed as a package (may need libportaudio2 at runtime) result_sd = subprocess.run( [ "uv", "run", "python", "-c", "import importlib.util; spec = importlib.util.find_spec('sounddevice'); print('sounddevice found' if spec else 'sounddevice NOT found')", ], capture_output=True, text=True, cwd="/home/claude/keineahnungirgendeintesthalt", ) assert result_sd.returncode == 0 assert "sounddevice found" in result_sd.stdout, "sounddevice package not installed"