2 new revisions:

Revision: ced5b4ef5383
Author:   Pekka Klärck
Date:     Thu Dec  1 03:36:30 2011
Log:      updated golden xml files after changing idx->id
http://code.google.com/p/robotframework/source/detail?r=ced5b4ef5383

Revision: c5dc66bad731
Author:   Pekka Klärck
Date:     Thu Dec  1 03:39:28 2011
Log:      stat.attrs and stat.js_attrs -> stat.get_attributes()
http://code.google.com/p/robotframework/source/detail?r=c5dc66bad731

==============================================================================
Revision: ced5b4ef5383
Author:   Pekka Klärck
Date:     Thu Dec  1 03:36:30 2011
Log:      updated golden xml files after changing idx->id
http://code.google.com/p/robotframework/source/detail?r=ced5b4ef5383

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

=======================================
--- /utest/result/golden.xml    Thu Oct 27 03:02:54 2011
+++ /utest/result/golden.xml    Thu Dec  1 03:36:30 2011
@@ -51,7 +51,7 @@
 <stat info="" links="" doc="" combined="" pass="1" fail="0">t1</stat>
 </tag>
 <suite>
-<stat fail="0" name="Normal" idx="s1" pass="1">Normal</stat>
+<stat fail="0" name="Normal" id="s1" pass="1">Normal</stat>
 </suite>
 </statistics>
 <errors>
=======================================
--- /utest/result/goldenTwice.xml       Thu Oct 27 03:02:54 2011
+++ /utest/result/goldenTwice.xml       Thu Dec  1 03:36:30 2011
@@ -99,9 +99,9 @@
 <stat info="" links="" doc="" combined="" pass="2" fail="0">t1</stat>
 </tag>
 <suite>
-<stat fail="0" name="Normal &amp; Normal" idx="s1" pass="2">Normal &amp; Normal</stat> -<stat fail="0" name="Normal" idx="s1-s1" pass="1">Normal &amp; Normal.Normal</stat> -<stat fail="0" name="Normal" idx="s1-s2" pass="1">Normal &amp; Normal.Normal</stat> +<stat fail="0" name="Normal &amp; Normal" id="s1" pass="2">Normal &amp; Normal</stat> +<stat fail="0" name="Normal" id="s1-s1" pass="1">Normal &amp; Normal.Normal</stat> +<stat fail="0" name="Normal" id="s1-s2" pass="1">Normal &amp; Normal.Normal</stat>
 </suite>
 </statistics>
 <errors>
=======================================
--- /utest/result/suite_teardown_failed.xml     Mon Oct 31 05:27:04 2011
+++ /utest/result/suite_teardown_failed.xml     Thu Dec  1 03:36:30 2011
@@ -57,7 +57,7 @@
 <tag>
 </tag>
 <suite>
-<stat fail="2" name="Suite Teardown Fail" idx="s1" pass="0">Suite Teardown Fail</stat> +<stat fail="2" name="Suite Teardown Fail" id="s1" pass="0">Suite Teardown Fail</stat>
 </suite>
 </statistics>
 <errors>

==============================================================================
Revision: c5dc66bad731
Author:   Pekka Klärck
Date:     Thu Dec  1 03:39:28 2011
Log:      stat.attrs and stat.js_attrs -> stat.get_attributes()
http://code.google.com/p/robotframework/source/detail?r=c5dc66bad731

Modified:
 /src/robot/model/stats.py
 /src/robot/result/jsondatamodelhandlers.py
 /src/robot/result/serializer.py

=======================================
--- /src/robot/model/stats.py   Thu Dec  1 03:28:40 2011
+++ /src/robot/model/stats.py   Thu Dec  1 03:39:28 2011
@@ -22,20 +22,15 @@
         self.passed = 0
         self.failed = 0

-    # TODO: Combine attrs and js_attrs propertys into get_attrs method
-
-    @property
-    def attrs(self):
-        attrs = {'pass': str(self.passed), 'fail': str(self.failed)}
+    def get_attributes(self, include_label=False, exclude_empty=False):
+        attrs =  {'pass': self.passed, 'fail': self.failed}
         attrs.update(self._get_custom_attrs())
+        if include_label:
+            attrs['label'] = self.name
+        if exclude_empty:
+            attrs = dict((k, v) for k, v in attrs.items() if v != '')
         return attrs

-    @property
-    def js_attrs(self):
- attrs = {'label': self.name, 'pass': self.passed, 'fail': self.failed}
-        attrs.update(self._get_custom_attrs())
- return dict((key, value) for key, value in attrs.items() if value != '')
-
     def _get_custom_attrs(self):
         return {}

=======================================
--- /src/robot/result/jsondatamodelhandlers.py  Wed Nov 30 04:48:02 2011
+++ /src/robot/result/jsondatamodelhandlers.py  Thu Dec  1 03:39:28 2011
@@ -111,7 +111,7 @@
 class StatHandler(_Handler):

     def build(self, stat):
-        return stat.js_attrs
+        return stat.get_attributes(include_label=True, exclude_empty=True)


 class SuiteHandler(_Handler):
=======================================
--- /src/robot/result/serializer.py     Tue Nov 29 22:13:42 2011
+++ /src/robot/result/serializer.py     Thu Dec  1 03:39:28 2011
@@ -45,5 +45,5 @@
     end_suite_statistics = XmlLogger.end_suite_stats

     def visit_stat(self, stat):
-        self._writer.element('stat', stat.name, stat.attrs)
-
+        self._writer.element('stat', stat.name, stat.get_attributes())
+

Reply via email to