From d0b97b89e7f31c1f3966ad79d1806f42cc95e89c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 24 Jun 2020 13:15:03 +1000 Subject: [PATCH] autotest: add an assert_receive_message method --- Tools/autotest/common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 7e5d0a4c63..f7c98fee4f 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -2157,6 +2157,12 @@ class AutoTest(ABC): raise ValueError("count %u not handled" % count) self.progress("Files same") + def assert_receive_message(self, type, timeout=1): + m = self.mav.recv_match(type=type, blocking=True, timeout=timeout) + if m is None: + raise NotAchievedException("Did not get %s" % type) + return m + def assert_rally_files_same(self, file1, file2): self.progress("Comparing (%s) and (%s)" % (file1, file2, )) f1 = open(file1)