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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 16 16:27:28 CDT 2013


Author: mjordan
Date: Tue Jul 16 16:27:26 2013
New Revision: 3921

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3921
Log:
Add an Asterisk start observer to the TestCase

This is a useful notification point that will let pluggable modules know
when Asterisk has started, but before AMI has connected

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

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=3921&r1=3920&r2=3921
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Tue Jul 16 16:27:26 2013
@@ -93,6 +93,7 @@
         self._stopping = False
         self.testlogdir = os.path.join(Asterisk.test_suite_root, self.base, str(os.getpid()))
         self.ast_version = AsteriskVersion()
+        self._start_callbacks = []
         self._stop_callbacks = []
         self._ami_callbacks = []
         self._pcap_callbacks = []
@@ -282,6 +283,8 @@
 
         def __run_callback(result):
             """ Notify the test that we are running """
+            for callback in self._start_callbacks:
+                callback(self)
             self.run()
             return result
 
@@ -503,6 +506,16 @@
         '''
         self._pcap_callbacks.append(callback)
 
+    def register_start_observer(self, callback):
+        ''' Register an observer that will be called when all Asterisk instances have
+        started
+
+        Parameters:
+        callback The deferred callback function to be called when all instances of
+        Asterisk have started. This will be passed this object as a parameter.
+        '''
+        self._start_callbacks.append(callback)
+
     def register_stop_observer(self, callback):
         ''' Register an observer that will be called when Asterisk is stopped
 




More information about the svn-commits mailing list