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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 9 10:47:58 CDT 2013


Author: mjordan
Date: Tue Apr  9 10:47:54 2013
New Revision: 3698

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3698
Log:
Update fail_token documentation

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=3698&r1=3697&r2=3698
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Tue Apr  9 10:47:54 2013
@@ -480,10 +480,11 @@
             logger.info("Test Condition %s failed but expected failure was set; test status not modified" % test_condition.getName())
 
     def evaluate_results(self):
-        """ Return whether or not the test has passed """
+        ''' Return whether or not the test has passed '''
+
         while len(self.fail_tokens):
             fail_token = self.fail_tokens.pop(0)
-            logger.error("Fail token present: %s" % fail_token['message'])
+            logger.error('Fail token present: %s' % fail_token['message'])
             self.passed = False
 
         return self.passed
@@ -510,18 +511,33 @@
         self._ami_callbacks.append(callback)
 
     def create_fail_token(self, message):
+        '''
+        Add a fail token to the test. If any fail tokens exist at the end of
+        the test, the test will fail.
+
+        Keyword Arguments:
+        message A text message describing the failure
+
+        Returns:
+        A token that can be removed from the test at a later time, if the test
+        should pass
+        '''
         fail_token = {'uuid' : uuid.uuid4(), 'message' : message}
         self.fail_tokens.append(fail_token)
         return fail_token
 
     def remove_fail_token(self, fail_token):
+        '''
+        Remove a fail token from the test.
+
+        Keyword Arguments:
+        fail_token A previously created fail token to be removed from the test
+        '''
         if not fail_token in self.fail_tokens:
-            logger.error("Attempted to remove a fail token that isn't in the fail tokens list\n"
-                         "    => '%s'\n"
-                         "    This fail token was probably already removed." % fail_token['message'])
+            logger.warning('Attempted to remove an unknown fail token: %s'
+                % fail_token['message'])
             self.passed = False
             return
-
         self.fail_tokens.remove(fail_token)
 
     def set_passed(self, value):




More information about the asterisk-commits mailing list