2 new revisions:

Revision: 6409e9eb3784
Author:   Pekka Klärck
Date:     Thu Aug 30 14:08:18 2012
Log: fixed unit test golden outputs after changing when suite metadata is w...
http://code.google.com/p/robotframework/source/detail?r=6409e9eb3784

Revision: 092a45f99d57
Author:   Pekka Klärck
Date:     Thu Aug 30 14:13:18 2012
Log: pyloggingconf: Tuning the error message if getting message fails....
http://code.google.com/p/robotframework/source/detail?r=092a45f99d57

==============================================================================
Revision: 6409e9eb3784
Author:   Pekka Klärck
Date:     Thu Aug 30 14:08:18 2012
Log: fixed unit test golden outputs after changing when suite metadata is written to xml
http://code.google.com/p/robotframework/source/detail?r=6409e9eb3784

Modified:
 /utest/result/golden.xml
 /utest/result/goldenTwice.xml

=======================================
--- /utest/result/golden.xml    Wed Mar  7 06:09:33 2012
+++ /utest/result/golden.xml    Thu Aug 30 14:08:18 2012
@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
<robot generated="20111024 13:41:20.873" generator="Robot trunk 20111007 (Python 2.7.2 on linux2)">
 <suite id="s1" source="normal.html" name="Normal">
-<metadata>
-<item name="Something">My Value</item>
-</metadata>
 <kw type="setup" name="my setup" timeout="1 year">
 <doc></doc>
 <arguments>
@@ -40,6 +37,9 @@
<status status="PASS" endtime="20111024 13:41:20.934" critical="yes" starttime="20111024 13:41:20.925"></status>
 </test>
 <doc>Normal test cases</doc>
+<metadata>
+<item name="Something">My Value</item>
+</metadata>
<status status="PASS" endtime="20111024 13:41:20.952" starttime="20111024 13:41:20.873"></status>
 </suite>
 <statistics>
=======================================
--- /utest/result/goldenTwice.xml       Wed Mar  7 06:09:33 2012
+++ /utest/result/goldenTwice.xml       Thu Aug 30 14:08:18 2012
@@ -1,12 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
<robot generated="20111027 10:11:57.563" generator="Rebot trunk 20111007 (Python 2.7.2+ on linux2)">
 <suite id="s1" name="Normal &amp; Normal">
-<metadata>
-</metadata>
 <suite id="s1-s1" source="normal.html" name="Normal">
-<metadata>
-<item name="Something">My Value</item>
-</metadata>
 <kw type="setup" name="my setup" timeout="1 year">
 <doc></doc>
 <arguments>
@@ -43,12 +38,12 @@
<status status="PASS" endtime="20111024 13:41:20.934" critical="yes" starttime="20111024 13:41:20.925"></status>
 </test>
 <doc>Normal test cases</doc>
-<status status="PASS" endtime="20111024 13:41:20.952" starttime="20111024 13:41:20.873"></status>
-</suite>
-<suite id="s1-s2" source="normal.html" name="Normal">
 <metadata>
 <item name="Something">My Value</item>
 </metadata>
+<status status="PASS" endtime="20111024 13:41:20.952" starttime="20111024 13:41:20.873"></status>
+</suite>
+<suite id="s1-s2" source="normal.html" name="Normal">
 <kw type="setup" name="my setup" timeout="1 year">
 <doc></doc>
 <arguments>
@@ -85,9 +80,14 @@
<status status="PASS" endtime="20111024 13:41:20.934" critical="yes" starttime="20111024 13:41:20.925"></status>
 </test>
 <doc>Normal test cases</doc>
+<metadata>
+<item name="Something">My Value</item>
+</metadata>
<status status="PASS" endtime="20111024 13:41:20.952" starttime="20111024 13:41:20.873"></status>
 </suite>
 <doc></doc>
+<metadata>
+</metadata>
<status status="PASS" elapsedtime="158" endtime="N/A" starttime="N/A"></status>
 </suite>
 <statistics>

==============================================================================
Revision: 092a45f99d57
Author:   Pekka Klärck
Date:     Thu Aug 30 14:13:18 2012
Log:      pyloggingconf: Tuning the error message if getting message fails.

Update issue 1212
Include also the error message, not only traceback, to the error logged if getting message fails.
http://code.google.com/p/robotframework/source/detail?r=092a45f99d57

Modified:
 /atest/robot/test_libraries/logging_with_logging.txt
 /src/robot/output/pyloggingconf.py

=======================================
--- /atest/robot/test_libraries/logging_with_logging.txt Thu Aug 30 07:15:56 2012 +++ /atest/robot/test_libraries/logging_with_logging.txt Thu Aug 30 14:13:18 2012
@@ -36,7 +36,7 @@
 Error in creating message is logged
     ${tc}=  Check test case  ${TEST NAME}
Check log message ${tc.kws[0].msgs[0]} Failed to log following message properly: <Unrepresentable object 'InvalidMessage'. Error: Should not have been logged> - Check log message ${tc.kws[0].msgs[1]} Traceback (most recent call last):* DEBUG pattern=true + Check log message ${tc.kws[0].msgs[1]} Should not have been logged\nTraceback (most recent call last):* DEBUG pattern=true

 Log using custom logger
     ${tc} =  Check test case  ${TEST NAME}
=======================================
--- /src/robot/output/pyloggingconf.py  Thu Aug 30 04:20:25 2012
+++ /src/robot/output/pyloggingconf.py  Thu Aug 30 14:13:18 2012
@@ -40,20 +40,20 @@
 class RobotHandler(logging.Handler):

     def emit(self, record):
-        message, details = self._get_message(record)
+        message, error = self._get_message(record)
         method = self._get_logger_method(record.levelno)
         method(message)
-        if details:
-            logger.debug(details)
+        if error:
+            logger.debug(error)

     def _get_message(self, record):
         try:
             return record.getMessage(), None
-        except Exception:
-            message = 'Failed to log following message properly: %s' % \
-                        utils.unic(record.msg)
-            details = utils.get_error_details()[1]
-            return message, details
+        except:
+            message = 'Failed to log following message properly: %s' \
+                        % utils.unic(record.msg)
+            error = '\n'.join(utils.get_error_details())
+            return message, error

     def _get_logger_method(self, level):
         if level >= logging.WARNING:

Reply via email to