Revision: 4543
Author: jussi.ao.malinen
Date: Tue Dec 28 07:39:33 2010
Log: Traceback from original exception in keywords with timeout.
Update issue 749
Status: Done
Owner: pekka.klarck
Cc: jussi.ao.malinen
Labels: Target-2.5.6
http://code.google.com/p/robotframework/source/detail?r=4543
Modified:
/trunk/atest/robot/core/timeouts.txt
/trunk/atest/testdata/core/timeouts.txt
/trunk/src/robot/utils/robotthread.py
=======================================
--- /trunk/atest/robot/core/timeouts.txt Tue Apr 13 04:34:10 2010
+++ /trunk/atest/robot/core/timeouts.txt Tue Dec 28 07:39:33 2010
@@ -19,6 +19,15 @@
Timed Test Fails Before Timeout
Check Test Case Failing Before Timeout
+Show Correct Trace Back When Failing Before Timeout
+ ${tc} = Check Test Case
+ Should Contain ${tc.kws[0].msgs[-1].message} raise
AssertionError(msg) if msg else AssertionError()
+
+Show Correct Trace Back When Failing In Java Before Timeout
+ [tags] jybot
+ ${tc} = Check Test Case
+ Should Contain ${tc.kws[0].msgs[-1].message} at
ExampleJavaLibrary.exception(
+
Timed Test Timeouts
Check Test Case Sleeping And Timeouting
Check Test Case Total Time Too Long
=======================================
--- /trunk/atest/testdata/core/timeouts.txt Tue Apr 13 04:34:10 2010
+++ /trunk/atest/testdata/core/timeouts.txt Tue Dec 28 07:39:33 2010
@@ -23,6 +23,18 @@
[Documentation] FAIL Failure before timeout
Fail Failure before timeout
+Show Correct Trace Back When Failing Before Timeout
+ [Documentation] FAIL Failure before timeout
+ [Setup] Set Log Level DEBUG
+ Fail Failure before timeout
+ [Teardown] Set Log Level INFO
+
+Show Correct Trace Back When Failing In Java Before Timeout
+ [Documentation] FAIL ArrayStoreException: This is exception message
+ [Setup] Set Log Level DEBUG
+ java exception This is exception message
+ [Teardown] Set Log Level INFO
+
Sleeping And Timeouting
[Documentation] FAIL Test timeout 4 seconds exceeded.
Sleep Without Logging 10
=======================================
--- /trunk/src/robot/utils/robotthread.py Mon May 31 05:21:54 2010
+++ /trunk/src/robot/utils/robotthread.py Tue Dec 28 07:39:33 2010
@@ -12,20 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import sys
from threading import Event
-
if sys.platform.startswith('java'):
- from java.lang import Thread, Runnable, Throwable
- JAVA_EXCEPTIONS = (Throwable,)
-
+ from java.lang import Thread, Runnable
else:
from stoppablethread import Thread
- class Runnable(object):
- pass
- JAVA_EXCEPTIONS = ()
+ Runnable = object
class ThreadedRunner(Runnable):
@@ -35,15 +29,14 @@
self._notifier = Event()
self._result = None
self._error = None
+ self._traceback = None
self._thread = None
def run(self):
try:
self._result = self._runnable()
- except JAVA_EXCEPTIONS, error:
- self._error = error
except:
- self._error = sys.exc_info()[1]
+ self._error, self._traceback = sys.exc_info()[1:]
self._notifier.set()
__call__ = run
@@ -57,7 +50,7 @@
def get_result(self):
if self._error:
- raise self._error
+ raise self._error, None, self._traceback
return self._result
def stop_thread(self):