Skip to content

Commit

Permalink
Update VK then step for checking messagetype
Browse files Browse the repository at this point in the history
Simplify the function and use the standard then_wait() for the heavy lifting,
this makes it utilize the new event driven functionality.
  • Loading branch information
forslund authored and rzr committed Aug 5, 2021
1 parent 79f09bb commit 197c76b
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
then_wait_fail)


TIMEOUT = 10
SLEEP_LENGTH = 0.25


def find_dialog(skill_path, dialog, lang):
"""Check the usual location for dialogs.
Expand Down Expand Up @@ -253,13 +249,10 @@ def then_user_follow_up(context, text):

@then('mycroft should send the message "{message_type}"')
def then_messagebus_message(context, message_type):
"""Set a timeout for the current Scenario."""
cnt = 0
while context.bus.get_messages(message_type) == []:
if cnt > int(TIMEOUT * (1.0 / SLEEP_LENGTH)):
assert False, "Message not found"
break
else:
cnt += 1

time.sleep(SLEEP_LENGTH)
"""Verify a specific message is sent."""
def check_dummy(message):
"""We are just interested in the message data, just the type."""
return True, ""

message_found, _ = then_wait(message_type, check_dummy, context)
assert message_found, "No matching message received."

0 comments on commit 197c76b

Please sign in to comment.