refactor: convert hotkey module to package with evdev backend

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vitali Graf
2026-04-08 10:28:52 +02:00
parent 5c8eecbb8b
commit f9bc2204c7
3 changed files with 32 additions and 9 deletions
+4 -3
View File
@@ -1,14 +1,16 @@
import asyncio
import sys
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from whisper_local.hotkey import HotkeyListener
pytestmark = pytest.mark.skipif(sys.platform != "linux", reason="evdev only available on Linux")
@pytest.fixture
def listener():
return HotkeyListener(key_name="KEY_F12")
from whisper_local.hotkey._evdev import EvdevHotkeyListener
return EvdevHotkeyListener(key_name="KEY_F12")
class TestHotkeyListener:
@@ -33,6 +35,5 @@ class TestHotkeyListener:
@pytest.mark.asyncio
async def test_no_callback_no_error(self, listener):
# Kein Callback gesetzt — soll nicht crashen
await listener._handle_key_event(key_down=True)
await listener._handle_key_event(key_down=False)