Skip to content

Commit

Permalink
Update unit tests to use ready callback instead of querying messagebu…
Browse files Browse the repository at this point in the history
…s entrypoint
  • Loading branch information
NeonDaniel committed Nov 13, 2023
1 parent 55d223a commit 5a42951
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/api_method_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ def setUpClass(cls) -> None:
test_config["listener"]["VAD"]["module"] = "dummy"
assert test_config["stt"]["module"] == "deepspeech_stream_local"

ready_event = Event()

def _ready():
ready_event.set()

cls.speech_service = NeonSpeechClient(speech_config=test_config,
daemonic=False, bus=cls.bus)
daemonic=False, bus=cls.bus,
ready_hook=_ready())
assert cls.speech_service.config["stt"]["module"] == "deepspeech_stream_local"
cls.speech_service.start()
ready = False
timeout = time() + 120
while not ready and time() < timeout:
message = cls.bus.wait_for_response(
Message("mycroft.voice.is_ready"))
if message:
ready = message.data.get("status")
if not ready:

if not ready_event.wait(120):
raise TimeoutError("Speech module not ready after 120 seconds")
from ovos_plugin_manager.templates import STT
assert isinstance(cls.speech_service.voice_loop.stt, STT)
Expand Down Expand Up @@ -265,19 +265,19 @@ def setUpClass(cls) -> None:
test_config["listener"]["VAD"]["module"] = "dummy"
assert test_config["stt"]["module"] == "neon-stt-plugin-nemo"

ready_event = Event()

def _ready():
ready_event.set()

cls.speech_service = NeonSpeechClient(speech_config=test_config,
daemonic=False, bus=cls.bus)
daemonic=False, bus=cls.bus,
ready_hook=_ready)
assert cls.speech_service.config["stt"]["module"] == \
"neon-stt-plugin-nemo"
cls.speech_service.start()
ready = False
timeout = time() + 120
while not ready and time() < timeout:
message = cls.bus.wait_for_response(
Message("mycroft.voice.is_ready"))
if message:
ready = message.data.get("status")
if not ready:

if not ready_event.wait(120):
raise TimeoutError("Speech module not ready after 120 seconds")
from ovos_plugin_manager.templates import STT
assert isinstance(cls.speech_service.voice_loop.stt, STT)
Expand Down

0 comments on commit 5a42951

Please sign in to comment.