[chirp_devel] [PATCH] Make tests check validate_memory()
Dan Smith
Sat Oct 8 18:53:54 PDT 2016
# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1475978023 25200
# Sat Oct 08 18:53:43 2016 -0700
# Node ID 6b50c7f7235329124e81499c8eed4539a18b15b4
# Parent 862dc68beecad824909ad6bd8e612b5eef32fb03
Make tests check validate_memory()
This makes the BruteForce test check validate_memory() before trying
to set it in the radio and subsequently failing. If a radio doesn't
validate a memory it may have some weird requirements. Also, make
the edges test try to use the first mode out of the valid_modes list
instead of the default 'FM'.
Related to issue #4119
diff -r 862dc68beeca -r 6b50c7f72353 tests/run_tests
--- a/tests/run_tests Mon Oct 03 21:25:05 2016 -0400
+++ b/tests/run_tests Sat Oct 08 18:53:43 2016 -0700
@@ -425,6 +425,7 @@
return True
return False
+ successes = 0
for mode in rf.valid_modes:
if mode not in chirp_common.MODES:
continue
@@ -442,7 +443,18 @@
m.freq += 100000000
m.mode = mode
+
+ if rf.validate_memory(m):
+ # A result (of error messages) from validate means the radio
+ # thinks this is invalid, so don't fail the test
+ continue
+
self.set_and_compare(m)
+ successes += 1
+
+ if (not successes) and rf.valid_modes:
+ raise TestFailedError("All modes were skipped, "
+ "something went wrong")
def run(self):
rf = self._wrapper.do("get_features")
@@ -489,6 +501,11 @@
m.freq = rf.valid_bands[0][0] + 1000000
if m.freq < 30000000 and "AM" in rf.valid_modes:
m.mode = "AM"
+ else:
+ try:
+ m.mode = rf.valid_modes[0]
+ except IndexError:
+ pass
return m
def do_longname(self, rf):
More information about the chirp_devel
mailing list