Revision: c954b3eaf0b7
Branch:   default
Author:   Pekka Klärck
Date:     Fri May 24 03:05:28 2013
Log:      Tuned ROBOT_EXIT_FOR_LOOP deprecation.

Update issue 1436
Status: Done
Cc: pekka.klarck
Implementation looked good. I removed some excess whitespace and enhanced the deprecation message a bit, though.
http://code.google.com/p/robotframework/source/detail?r=c954b3eaf0b7

Modified:
 /atest/robot/running/exit_for_loop.txt
 /src/robot/errors.py
 /src/robot/new_running/model.py

=======================================
--- /atest/robot/running/exit_for_loop.txt      Wed May 22 06:09:24 2013
+++ /atest/robot/running/exit_for_loop.txt      Fri May 24 03:05:28 2013
@@ -35,7 +35,10 @@
     Should Be Empty    ${tc.kws[0].kws[0].kws[0].msgs}

 Custom Exception with ROBOT_EXIT_FOR_LOOP Works But Is Deprecated
- Check Log Message ${ERRORS[0]} Using ROBOT_EXIT_FOR_LOOP is deprecated in 2.8. WARN
+    ${msg} =    Catenate
+ ... Support for using 'ROBOT_EXIT_FOR_LOOP' attribute to exit for loops
+    ...    is deprecated in Robot Framework 2.8 and will be removed in 2.9.
+    Check Log Message   ${ERRORS[0]}    ${msg}   WARN
     Test And All Keywords Should Have Passed

 Exit For Loop In Test Teardown
=======================================
--- /src/robot/errors.py        Thu May 23 06:00:33 2013
+++ /src/robot/errors.py        Fri May 24 03:05:28 2013
@@ -126,23 +126,25 @@
         details = utils.ErrorDetails()
         timeout = isinstance(details.error, TimeoutError)
         syntax = isinstance(details.error, DataError)
-        exit = self._get(details.error, 'EXIT_ON_FAILURE')
+        exit_on_failure = self._get(details.error, 'EXIT_ON_FAILURE')
continue_on_failure = self._get(details.error, 'CONTINUE_ON_FAILURE')
-
-        if self._get(details.error, 'EXIT_FOR_LOOP'):
-            from robot.output import LOGGER
-            LOGGER.warn('Using ROBOT_EXIT_FOR_LOOP is deprecated in 2.8.')
-            raise ExitForLoop
-
         ExecutionFailed.__init__(self, details.message, timeout, syntax,
-                                 exit, continue_on_failure)
-
+                                 exit_on_failure, continue_on_failure)
         self.full_message = details.message
         self.traceback = details.traceback
+        self._handle_deprecated_exit_for_loop(details.error)

     def _get(self, error, attr):
         return bool(getattr(error, 'ROBOT_' + attr, False))

+    def _handle_deprecated_exit_for_loop(self, error):
+        if self._get(error, 'EXIT_FOR_LOOP'):
+            from robot.output import LOGGER
+ LOGGER.warn("Support for using 'ROBOT_EXIT_FOR_LOOP' attribute to " + "exit for loops is deprecated in Robot Framework 2.8 "
+                        "and will be removed in 2.9.")
+            raise ExitForLoop
+

 class ExecutionFailures(ExecutionFailed):

=======================================
--- /src/robot/new_running/model.py     Wed May 22 15:27:57 2013
+++ /src/robot/new_running/model.py     Fri May 24 03:05:28 2013
@@ -1,4 +1,4 @@
-    #  Copyright 2008-2012 Nokia Siemens Networks Oyj
+#  Copyright 2008-2012 Nokia Siemens Networks Oyj
 #
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to