Skip to content

Commit

Permalink
More message context troubleshooting
Browse files Browse the repository at this point in the history
Annotate rationale for expected context in tests
  • Loading branch information
NeonDaniel committed Jan 2, 2024
1 parent c09608c commit c435a22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ovos_core/intent_services/commonqa_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def _query_timeout(self, message: Message):
LOG.info('Handling with: ' + str(best['skill_id']))
cb = best.get('callback_data') or {}
self.bus.emit(message.forward('question:action',
data={'skill_id': best['skill_id'],
'phrase': search_phrase,
'callback_data': cb}))
data={'skill_id': best['skill_id'],
'phrase': search_phrase,
'callback_data': cb}))
query.answered = True
else:
query.answered = False
Expand Down
7 changes: 4 additions & 3 deletions test/unittests/common_query/test_common_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@ def test_common_query_events(self):
'lang': 'en-us'},
'context': skill_ans_ctxt},
# skill callback event (after response is sent to Audio service)
# the destination here is `skills`
# the destination here is `skills` and skill_id context is
# CommonQuery since this event is not dictated by the selected skill
{'type': 'question:action',
'data': {'skill_id': 'wiki.test',
'phrase': 'what is the speed of light',
'callback_data': {'query': 'what is the speed of light',
'answer': 'answer 1'}},
'context': skill_ctxt}
'context': qq_ctxt}
]

for ctr, msg in enumerate(expected):
m = self.bus.emitted_msgs[ctr]
m: dict = self.bus.emitted_msgs[ctr]
if "session" in m.get("context", {}):
m["context"].pop("session") # simplify test comparisons
if "session" in msg.get("context", {}):
Expand Down

0 comments on commit c435a22

Please sign in to comment.