|
|
@@ -0,0 +1,20 @@
|
|
|
+"""DW LED controller: a failing `import board` must surface as _init_error, not raise."""
|
|
|
+import builtins
|
|
|
+
|
|
|
+from modules.led.dw_led_controller import DWLEDController
|
|
|
+
|
|
|
+
|
|
|
+def test_blinka_runtime_error_is_reported_not_raised(monkeypatch):
|
|
|
+ real_import = builtins.__import__
|
|
|
+
|
|
|
+ def fake_import(name, *args, **kwargs):
|
|
|
+ if name == "board":
|
|
|
+ # What Blinka >=10 raises from `import board` when gpiod is out of range
|
|
|
+ raise RuntimeError("Blinka found installed platform dependencies with unsupported versions.")
|
|
|
+ return real_import(name, *args, **kwargs)
|
|
|
+
|
|
|
+ monkeypatch.setattr(builtins, "__import__", fake_import)
|
|
|
+
|
|
|
+ controller = DWLEDController()
|
|
|
+ assert controller._initialize_hardware() is False
|
|
|
+ assert "unsupported versions" in controller._init_error
|