feat(dictate): support configurable ASR backends
This commit is contained in:
@@ -173,6 +173,10 @@ class UnixLoopTests(unittest.TestCase):
|
||||
class ActivationTests(unittest.TestCase):
|
||||
def test_inherited_listener_requires_one_fd_for_this_process_and_wraps_fd_three(self) -> None:
|
||||
listener = Mock()
|
||||
listener.family = socket.AF_UNIX
|
||||
listener.type = socket.SOCK_STREAM
|
||||
listener.getsockopt.return_value = 1
|
||||
listener.getsockname.return_value = "/run/user/1000/pi-dictate.sock"
|
||||
with patch("pi_dictate_service.server.os.getpid", return_value=42), patch(
|
||||
"pi_dictate_service.server.socket.socket", return_value=listener
|
||||
) as socket_factory:
|
||||
@@ -189,7 +193,9 @@ class ActivationTests(unittest.TestCase):
|
||||
inherited_listener({"LISTEN_PID": "41", "LISTEN_FDS": "1"})
|
||||
|
||||
def test_main_requires_local_model_path_and_reads_idle_override(self) -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
with patch.dict(os.environ, {}, clear=True), patch(
|
||||
"pi_dictate_service.server.os.path.isfile", return_value=False
|
||||
):
|
||||
with self.assertRaisesRegex(SystemExit, "PI_DICTATE_MODEL_PATH"):
|
||||
main()
|
||||
|
||||
@@ -201,10 +207,12 @@ class ActivationTests(unittest.TestCase):
|
||||
"PI_DICTATE_MODEL_PATH": "/models/parakeet.nemo",
|
||||
"PI_DICTATE_TERMS_PATH": "/config/coding-terms.txt",
|
||||
"PI_DICTATE_BOOST_ALPHA": "0.5",
|
||||
"PI_DICTATE_IDLE_SECONDS": "12.5",
|
||||
"PI_DICTATE_IDLE_SECONDS": "120",
|
||||
},
|
||||
clear=True,
|
||||
), patch("pi_dictate_service.server.NemoParakeetModel", return_value=model) as adapter, patch(
|
||||
), patch("pi_dictate_service.server.os.path.isfile", return_value=False), patch(
|
||||
"pi_dictate_service.server.NemoParakeetModel", return_value=model
|
||||
) as adapter, patch(
|
||||
"pi_dictate_service.server.DictateServiceCore"
|
||||
) as core_factory, patch(
|
||||
"pi_dictate_service.server.inherited_listener", return_value=listener
|
||||
@@ -217,7 +225,7 @@ class ActivationTests(unittest.TestCase):
|
||||
terms_path="/config/coding-terms.txt",
|
||||
boost_alpha=0.5,
|
||||
)
|
||||
core_factory.assert_called_once_with(model=model, idle_seconds=12.5)
|
||||
core_factory.assert_called_once_with(model=model, idle_seconds=120)
|
||||
serve_loop.assert_called_once_with(listener, core)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user