6 new revisions:
Revision: 0c709f6c1d62
Author: Pekka Klärck
Date: Thu Jun 16 10:19:00 2011
Log: import cleanup
http://code.google.com/p/robotframework/source/detail?r=0c709f6c1d62
Revision: ab9a38bf5b6b
Author: Pekka Klärck
Date: Thu Jun 16 10:21:18 2011
Log: Cleanup elementhandlers....
http://code.google.com/p/robotframework/source/detail?r=ab9a38bf5b6b
Revision: 3064c6296cfe
Author: Pekka Klärck
Date: Thu Jun 16 11:24:17 2011
Log: fixed test after replacing '_' -> ' ' changed to different place
http://code.google.com/p/robotframework/source/detail?r=3064c6296cfe
Revision: c1e949ad668c
Author: Pekka Klärck
Date: Thu Jun 16 11:25:09 2011
Log: simpler way to put all attrs from xml to json
http://code.google.com/p/robotframework/source/detail?r=c1e949ad668c
Revision: dc908bcddc99
Author: Pekka Klärck
Date: Thu Jun 16 11:25:32 2011
Log: fixed test after json format changed
http://code.google.com/p/robotframework/source/detail?r=dc908bcddc99
Revision: bc71db1bae36
Author: Pekka Klärck
Date: Thu Jun 16 11:25:37 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=bc71db1bae36
==============================================================================
Revision: 0c709f6c1d62
Author: Pekka Klärck
Date: Thu Jun 16 10:19:00 2011
Log: import cleanup
http://code.google.com/p/robotframework/source/detail?r=0c709f6c1d62
Modified:
/src/robot/result/jsparser.py
=======================================
--- /src/robot/result/jsparser.py Wed Jun 15 22:34:30 2011
+++ /src/robot/result/jsparser.py Thu Jun 16 10:19:00 2011
@@ -13,10 +13,10 @@
# limitations under the License.
from __future__ import with_statement
+from xml import sax
+
from robot.result.elementhandlers import RootHandler, Context
from robot.result.jsondatamodel import DataModel
-from xml import sax
-from xml.sax.handler import ContentHandler
def create_datamodel_from(input_filename):
@@ -30,7 +30,7 @@
create_datamodel_from(input_filename).write_to(output)
-class _RobotOutputHandler(ContentHandler):
+class _RobotOutputHandler(sax.handler.ContentHandler):
def __init__(self, context):
self._context = context
==============================================================================
Revision: ab9a38bf5b6b
Author: Pekka Klärck
Date: Thu Jun 16 10:21:18 2011
Log: Cleanup elementhandlers.
1) Explicitly set _Handler's attrs args to be optional.
2) Don't pass attrs to _Handler.__init__ for nothing.
3) Use attrs.get consistently (was mixed with attrs.getValue)
http://code.google.com/p/robotframework/source/detail?r=ab9a38bf5b6b
Modified:
/src/robot/result/elementhandlers.py
=======================================
--- /src/robot/result/elementhandlers.py Thu Jun 16 05:42:50 2011
+++ /src/robot/result/elementhandlers.py Thu Jun 16 10:21:18 2011
@@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-from time import time
import zlib
import base64
@@ -21,7 +20,7 @@
class _Handler(object):
- def __init__(self, context, *args):
+ def __init__(self, context, attrs=None):
self._context = context
self._data_from_children = []
self._handlers = {
@@ -64,8 +63,8 @@
class _RobotHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
- self._generator = attrs.getValue('generator')
+ _Handler.__init__(self, context)
+ self._generator = attrs.get('generator')
def end_element(self, text):
return {'generator': self._generator,
@@ -79,8 +78,8 @@
class _SuiteHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
- self._name = attrs.getValue('name')
+ _Handler.__init__(self, context)
+ self._name = attrs.get('name')
self._source = attrs.get('source') or ''
self._context.start_suite(self._name)
self._context.collect_stats()
@@ -94,8 +93,8 @@
class _TestHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
- name = attrs.getValue('name')
+ _Handler.__init__(self, context)
+ name = attrs.get('name')
self._name_id = self._context.get_text_id(name)
self._timeout = self._context.get_text_id(attrs.get('timeout'))
self._context.start_test(name)
@@ -116,11 +115,11 @@
class _KeywordHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
+ _Handler.__init__(self, context)
self._context.start_keyword()
- self._type = attrs.getValue('type')
- self._name = self._context.get_text_id(attrs.getValue('name'))
- self._timeout =
self._context.get_text_id(attrs.getValue('timeout'))
+ self._type = attrs.get('type')
+ self._name = self._context.get_text_id(attrs.get('name'))
+ self._timeout = self._context.get_text_id(attrs.get('timeout'))
def end_element(self, text):
if self._type == 'teardown' and self._data_from_children[-1][0]
== 'F':
@@ -138,10 +137,10 @@
class _StatItemHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
+ _Handler.__init__(self, context)
self._attrs = {
- 'pass': int(attrs.getValue('pass')),
- 'fail': int(attrs.getValue('fail')),
+ 'pass': int(attrs.get('pass')),
+ 'fail': int(attrs.get('fail')),
'doc': attrs.get('doc', ''),
'info': attrs.get('info', ''),
'links': attrs.get('links', ''),
@@ -157,9 +156,9 @@
class _StatusHandler(object):
def __init__(self, context, attrs):
self._context = context
- self._status = attrs.getValue('status')[0]
- self._starttime =
self._context.timestamp(attrs.getValue('starttime'))
- endtime = self._context.timestamp(attrs.getValue('endtime'))
+ self._status = attrs.get('status')[0]
+ self._starttime = self._context.timestamp(attrs.get('starttime'))
+ endtime = self._context.timestamp(attrs.get('endtime'))
self._elapsed = self._calculate_elapsed(endtime)
def _calculate_elapsed(self, endtime):
@@ -198,7 +197,7 @@
class _MetadataHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
+ _Handler.__init__(self, context)
self._metadata = {}
def add_child_data(self, data):
@@ -211,19 +210,19 @@
class _MetadataItemHandler(_Handler):
def __init__(self, context, attrs):
- _Handler.__init__(self, context, attrs)
- self._name = attrs.getValue('name')
+ _Handler.__init__(self, context)
+ self._name = attrs.get('name')
def end_element(self, text):
return [self._name, self._context.get_text_id(text)]
-class _MsgHandler(object):
+class _MsgHandler(_Handler):
def __init__(self, context, attrs):
- self._context = context
- self._msg = [self._context.timestamp(attrs.getValue('timestamp')),
- attrs.getValue('level')[0]]
+ _Handler.__init__(self, context)
+ self._msg = [self._context.timestamp(attrs.get('timestamp')),
+ attrs.get('level')[0]]
self._is_html = attrs.get('html')
self._is_linkable = attrs.get("linkable") == "yes"
==============================================================================
Revision: 3064c6296cfe
Author: Pekka Klärck
Date: Thu Jun 16 11:24:17 2011
Log: fixed test after replacing '_' -> ' ' changed to different place
http://code.google.com/p/robotframework/source/detail?r=3064c6296cfe
Modified:
/utest/common/test_statistics.py
=======================================
--- /utest/common/test_statistics.py Fri May 28 03:44:45 2010
+++ /utest/common/test_statistics.py Thu Jun 16 11:24:17 2011
@@ -195,7 +195,7 @@
def test_combine_with_name(self):
for comb_tags, expected_name in [
( [], '' ),
- ( ['t1&t2:my_name'], 'my name' ),
+ ( ['t1&t2:my name'], 'my name' ),
( ['t1NOTt3:Others'], 'Others' ),
( ['1:2&2:3:nAme'], 'nAme' ),
( ['3*'], '3*' ),
==============================================================================
Revision: c1e949ad668c
Author: Pekka Klärck
Date: Thu Jun 16 11:25:09 2011
Log: simpler way to put all attrs from xml to json
http://code.google.com/p/robotframework/source/detail?r=c1e949ad668c
Modified:
/src/robot/result/elementhandlers.py
=======================================
--- /src/robot/result/elementhandlers.py Thu Jun 16 10:21:18 2011
+++ /src/robot/result/elementhandlers.py Thu Jun 16 11:25:09 2011
@@ -138,15 +138,11 @@
def __init__(self, context, attrs):
_Handler.__init__(self, context)
- self._attrs = {
- 'pass': int(attrs.get('pass')),
- 'fail': int(attrs.get('fail')),
- 'doc': attrs.get('doc', ''),
- 'info': attrs.get('info', ''),
- 'links': attrs.get('links', ''),
- 'combined': attrs.get('combined', ''),
- 'name': attrs.get('name', '')
- }
+ self._attrs = dict(attrs)
+ self._attrs['pass'] = int(self._attrs['pass'])
+ self._attrs['fail'] = int(self._attrs['fail'])
+ # TODO: Should we only dump attrs that have value?
+ # Tag stats have many attrs that are normally empty
def end_element(self, text):
self._attrs.update(label=text)
==============================================================================
Revision: dc908bcddc99
Author: Pekka Klärck
Date: Thu Jun 16 11:25:32 2011
Log: fixed test after json format changed
http://code.google.com/p/robotframework/source/detail?r=dc908bcddc99
Modified:
/utest/result/test_js_serializer.py
=======================================
--- /utest/result/test_js_serializer.py Wed Jun 15 22:34:30 2011
+++ /utest/result/test_js_serializer.py Thu Jun 16 11:25:32 2011
@@ -169,29 +169,31 @@
statistics_xml = """
<statistics>
<total>
- <stat fail="4" doc="" pass="0">Critical Tests</stat>
- <stat fail="4" doc="" pass="0">All Tests</stat>
+ <stat fail="4" pass="0">Critical Tests</stat>
+ <stat fail="4" pass="0">All Tests</stat>
</total>
<tag>
<stat info="" fail="1" pass="0" links=""
doc="">someothertag</stat>
<stat info="" fail="1" pass="0" links=""
doc="">sometag</stat>
</tag>
<suite>
- <stat fail="4" doc="Data" pass="0">Data</stat>
- <stat fail="1" doc="Data.All Settings" pass="0">Data.All
Settings</stat>
- <stat fail="3" doc="Data.Failing Suite"
pass="0">Data.Failing Suite</stat>
+ <stat fail="4" name="Data" pass="0">Data</stat>
+ <stat fail="1" name="All Settings" pass="0">Data.All
Settings</stat>
+ <stat fail="3" name="Failing Suite" pass="0">Data.Failing
Suite</stat>
</suite>
</statistics>
"""
data_model = self._get_data_model(statistics_xml)
- self.assert_model(data_model, 0,
- [[['Critical Tests', 0, 4, '', '', ''],
- ['All Tests', 0, 4, '', '', '']],
- [['someothertag', 0, 1, '', '', ''],
- ['sometag', 0, 1, '', '', '']],
- [['Data', 0, 4, 'Data', '', ''],
- ['Data.All Settings', 0, 1, 'Data.All Settings', '', ''],
- ['Data.Failing Suite', 0, 3, 'Data.Failing
Suite', '', '']]], ['*'])
+ expected = [[{'label': 'Critical Tests', 'pass': 0, 'fail': 4},
+ {'label': 'All Tests', 'pass': 0, 'fail': 4}],
+ [{'label': 'someothertag', 'pass': 0, 'fail': 1,
+ 'info': '', 'links': '', 'doc': ''},
+ {'label': 'sometag', 'pass': 0, 'fail': 1,
+ 'info': '', 'links': '', 'doc': ''}],
+ [{'label': 'Data', 'name': 'Data', 'pass': 0, 'fail':
4},
+ {'label': 'Data.All Settings', 'name': 'All
Settings', 'pass': 0, 'fail': 1},
+ {'label': 'Data.Failing Suite', 'name': 'Failing
Suite', 'pass': 0, 'fail': 3}]]
+ self.assert_model(data_model, 0, expected, ['*'])
def test_errors_xml_parsing(self):
errors_xml = """
==============================================================================
Revision: bc71db1bae36
Author: Pekka Klärck
Date: Thu Jun 16 11:25:37 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=bc71db1bae36