[asterisk-commits] russell: testsuite/asterisk/trunk r171 - in /asterisk/trunk: ./ tests/sip_cha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 1 12:19:17 CDT 2010
Author: russell
Date: Thu Apr 1 12:19:14 2010
New Revision: 171
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=171
Log:
Don't blow up if an invalid version string is provided in configuration.
Also, in passing, use "in" for checking if a key is in a dictionary instead
of the has_key() method.
Modified:
asterisk/trunk/runtests.py
asterisk/trunk/tests/sip_channel_params/test-config.yaml
Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=171&r1=170&r2=171
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Thu Apr 1 12:19:14 2010
@@ -36,10 +36,10 @@
def __init__(self, dep):
self.name = ""
self.met = False
- if dep.has_key("app"):
+ if "app" in dep:
self.name = dep["app"]
self.met = self.__which(self.name) is not None
- elif dep.has_key("python"):
+ elif "python" in dep:
self.name = dep["python"]
try:
__import__(self.name)
@@ -99,24 +99,34 @@
def __process_testinfo(self):
self.summary = "(none)"
self.description = "(none)"
- if self.config.has_key("testinfo") is False:
+ if "testinfo" not in self.config:
return
testinfo = self.config["testinfo"]
- if testinfo.has_key("summary"):
+ if "summary" in testinfo:
self.summary = testinfo["summary"]
- if testinfo.has_key("description"):
+ if "description" in testinfo:
self.description = testinfo["description"]
def __process_properties(self):
self.minversion = AsteriskVersion("1.4")
self.maxversion = None
- if self.config.has_key("properties") is False:
+ if "properties" not in self.config:
return
properties = self.config["properties"]
- if properties.has_key("minversion"):
- self.minversion = AsteriskVersion(properties["minversion"])
- if properties.has_key("maxversion"):
- self.maxversion = AsteriskVersion(properties["maxversion"])
+ if "minversion" in properties:
+ try:
+ self.minversion = AsteriskVersion(properties["minversion"])
+ except:
+ self.can_run = False
+ print "ERROR: '%s' is not a valid minversion" % \
+ properties["minversion"]
+ if "maxversion" in properties:
+ try:
+ self.maxversion = AsteriskVersion(properties["maxversion"])
+ except:
+ self.can_run = False
+ print "ERROR: '%s' is not a valid maxversion" % \
+ properties["maxversion"]
def __parse_config(self):
test_config = "tests/%s/test-config.yaml" % self.test_name
Modified: asterisk/trunk/tests/sip_channel_params/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_channel_params/test-config.yaml?view=diff&rev=171&r1=170&r2=171
==============================================================================
--- asterisk/trunk/tests/sip_channel_params/test-config.yaml (original)
+++ asterisk/trunk/tests/sip_channel_params/test-config.yaml Thu Apr 1 12:19:14 2010
@@ -13,7 +13,6 @@
issues:
-jira : SWP-1016
-jira : ABE-2103
-
properties:
minversion: '1.8'
More information about the asterisk-commits
mailing list