[asterisk-commits] mjordan: testsuite/asterisk/trunk r3835 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 11 11:28:07 CDT 2013


Author: mjordan
Date: Tue Jun 11 11:28:05 2013
New Revision: 3835

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3835
Log:
Use the AsteriskVersion class to compare version strings

Python will automatically compare strings for equality, which isn't
what we want when comparing Asterisk version strings. The AsteriskVersion
class correctly weights the various components of an Asterisk version so
that two versions can be compared correctly. This patch modifies the
test module loading to use the AsteriskVersion class when performing
module version comparisons.

Modified:
    asterisk/trunk/lib/python/asterisk/TestRunner.py

Modified: asterisk/trunk/lib/python/asterisk/TestRunner.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestRunner.py?view=diff&rev=3835&r1=3834&r2=3835
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestRunner.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestRunner.py Tue Jun 11 11:28:05 2013
@@ -23,6 +23,8 @@
 LOGGER = logging.getLogger('TestRunner')
 
 sys.path.append('lib/python')
+
+from version import AsteriskVersion
 
 class TestModuleFinder(object):
     ''' Determines if a module is a test module that can be loaded '''
@@ -133,9 +135,11 @@
 
     modminversion = module_spec.get('minversion')
     modmaxversion = module_spec.get('maxversion')
-    if modminversion is not None and ast_version < modminversion:
+    if modminversion is not None and \
+        AsteriskVersion(ast_version) < AsteriskVersion(modminversion):
         return False
-    if modmaxversion is not None and ast_version > modmaxversion:
+    if modmaxversion is not None and \
+        AsteriskVersion(ast_version) > AsteriskVersion(modmaxversion):
         return False
 
     return True




More information about the asterisk-commits mailing list