[asterisk-commits] mjordan: testsuite/asterisk/trunk r6157 - /asterisk/trunk/tests/channels/pjsi...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 31 22:48:50 CST 2014


Author: mjordan
Date: Wed Dec 31 22:48:44 2014
New Revision: 6157

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6157
Log:
channels/pjsip/keep_alive: Fix format issue for Python 2.6-

In Python 2.6-, the string format method requires positional arguments. Not
providing them (which is allowed in 2.7+) results in an exception. This patch
corrects the log messages with positional arguments, which is valid for all
reasonable versions of Python.

On another note, can we all agree that Python 2.7 should be the defacto
2.x standard on CentOS by now? I was shocked when I saw that CentOS 6 delivers
2.6 by default. Sheesh.

And... thus ends my last commit in 2014. Here's to 2015!

Modified:
    asterisk/trunk/tests/channels/pjsip/keep_alive/keep_alive.py

Modified: asterisk/trunk/tests/channels/pjsip/keep_alive/keep_alive.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/keep_alive/keep_alive.py?view=diff&rev=6157&r1=6156&r2=6157
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/keep_alive/keep_alive.py (original)
+++ asterisk/trunk/tests/channels/pjsip/keep_alive/keep_alive.py Wed Dec 31 22:48:44 2014
@@ -33,7 +33,7 @@
         self.test_object = test_object
 
     def dataReceived(self, data):
-        LOGGER.debug('Received packet: {}'.format(data))
+        LOGGER.debug('Received packet: {0}'.format(data))
         received_packets.append((datetime.utcnow(), data))
         if len(received_packets) == 5:
             self.transport.loseConnection()
@@ -56,14 +56,14 @@
 
     def clientConnectionFailed(self, connector, reason):
         """twisted callback for a failed client connection"""
-        LOGGER.warn('Failed to connect to Asterisk on port 5060: {}'.format(
+        LOGGER.warn('Failed to connect to Asterisk on port 5060: {0}'.format(
             reason))
         self.test_object.set_passed(False)
         self.test_object.stop_reactor()
 
     def clientConnectionLost(self, connector, reason):
         """twisted callback for a lost client connection"""
-        LOGGER.info('Client connection dropped: {}'.format(reason))
+        LOGGER.info('Client connection dropped: {0}'.format(reason))
         self.test_object.stop_reactor()
 
 
@@ -98,7 +98,7 @@
         Used to verify that we got our packets.
         """
         if len(received_packets) != 5:
-            LOGGER.warn('Failed to get 5 packets: got {} instead'.format(
+            LOGGER.warn('Failed to get 5 packets: got {0} instead'.format(
                 len(received_packets)))
             self.test_object.set_passed(False)
             return result
@@ -107,14 +107,14 @@
                   zip(received_packets[:-1], received_packets[1:])]
         if not all([d == 2 for d in deltas]):
             LOGGER.warn('Failed to get expected deltas between keep-alives')
-            LOGGER.warn('Deltas: {}'.format(deltas))
-            LOGGER.warn('Received packets: {}'.format(received_packets))
+            LOGGER.warn('Deltas: {0}'.format(deltas))
+            LOGGER.warn('Received packets: {0}'.format(received_packets))
             self.test_object.set_passed(False)
             return result
 
         if not all([p[1] == '\r\n\r\n' for p in received_packets]):
             LOGGER.warn('Failed to get expected keep-alive values')
-            LOGGER.warn('Received packets: {}'.format(received_packets))
+            LOGGER.warn('Received packets: {0}'.format(received_packets))
             self.test_object.set_passed(False)
             return result
 




More information about the asterisk-commits mailing list