[chirp_devel] [PATCH] Add get-set-get then compare to settings test

Marco Filippi IZ3GME
Wed Feb 18 04:08:18 PST 2015


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1424260661 -3600
#      Wed Feb 18 12:57:41 2015 +0100
# Node ID 2e131fe2d1ad5b9272527ab0b9b4fa647a45ef68
# Parent  d4536c8fcc48e6a61a573e680f0ab518ff8f09b9
Add get-set-get then compare to settings test

Try to reveal incongruences in get/set_settings doing a "before and after"
comparision
Currently all images passes the test.

improves #2235

diff --git a/tests/run_tests b/tests/run_tests
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -530,8 +530,24 @@
     def do_get_settings(self, rf):
         lst = self._wrapper.do("get_settings")
         if not isinstance(lst, list):
-	    raise TestFailedError("Invalid Radio Settings")
-        self._wrapper.do("set_settings", lst)
+            raise TestFailedError("Invalid Radio Settings")
+
+    def do_same_settings(self, rf):
+        o = self._wrapper.do("get_settings")
+        self._wrapper.do("set_settings", o)
+        n = self._wrapper.do("get_settings")
+        map(self.compare_settings, o, n)
+
+    @staticmethod
+    def compare_settings(a, b):
+        try:
+            map(TestCaseSettings.compare_settings, a, b)
+        except TypeError:
+            if a.get_value() != b.get_value():
+                msg = "Field is `%s', " % b + \
+                    "expected `%s' " % a
+                details = msg
+                raise TestFailedError(msg, details)
 
     def run(self):
         rf = self._wrapper.do("get_features")
@@ -539,7 +555,8 @@
         if not rf.has_settings:
             raise TestSkippedError("Settings not supported")
 
-	self.do_get_settings(rf)
+        self.do_get_settings(rf)
+        self.do_same_settings(rf)
 
         return []
 



More information about the chirp_devel mailing list