From c435a22048803b2a030aa9d1d86a155a44cd112f Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 15 Nov 2023 10:43:49 -0800 Subject: [PATCH] More message context troubleshooting Annotate rationale for expected context in tests --- ovos_core/intent_services/commonqa_service.py | 6 +++--- test/unittests/common_query/test_common_query.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ovos_core/intent_services/commonqa_service.py b/ovos_core/intent_services/commonqa_service.py index fb5d7815a957..9ec0a9e05bec 100644 --- a/ovos_core/intent_services/commonqa_service.py +++ b/ovos_core/intent_services/commonqa_service.py @@ -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 diff --git a/test/unittests/common_query/test_common_query.py b/test/unittests/common_query/test_common_query.py index 09ae85e5bc10..a93b43b20a71 100644 --- a/test/unittests/common_query/test_common_query.py +++ b/test/unittests/common_query/test_common_query.py @@ -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", {}):