2 new revisions:
Revision: 17d3cfbbaa0c
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 04:51:10 2011
Log: removed unused argument
http://code.google.com/p/robotframework/source/detail?r=17d3cfbbaa0c
Revision: 6e50d27cc7e4
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 05:13:54 2011
Log: resultwriter: inlined unnecessary class
http://code.google.com/p/robotframework/source/detail?r=6e50d27cc7e4
==============================================================================
Revision: 17d3cfbbaa0c
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 04:51:10 2011
Log: removed unused argument
http://code.google.com/p/robotframework/source/detail?r=17d3cfbbaa0c
Modified:
/src/robot/reporting/resultwriter.py
=======================================
--- /src/robot/reporting/resultwriter.py Wed Nov 30 03:12:50 2011
+++ /src/robot/reporting/resultwriter.py Wed Nov 30 04:51:10 2011
@@ -85,14 +85,12 @@
self.result = execution_result
self._generator = 'Robot'
- def serialize_output(self, path, log=True):
- # TODO: Can `log` be False??
+ def serialize_output(self, path):
if path == 'NONE':
return
serializer = RebotXMLWriter(path)
self.result.visit(serializer)
- if log:
- LOGGER.output_file('Output', path)
+ LOGGER.output_file('Output', path)
def serialize_xunit(self, path):
if path == 'NONE':
==============================================================================
Revision: 6e50d27cc7e4
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 05:13:54 2011
Log: resultwriter: inlined unnecessary class
http://code.google.com/p/robotframework/source/detail?r=6e50d27cc7e4
Modified:
/src/robot/reporting/builders.py
/src/robot/reporting/resultwriter.py
/src/robot/reporting/xunitwriter.py
=======================================
--- /src/robot/reporting/builders.py Wed Nov 30 01:40:01 2011
+++ /src/robot/reporting/builders.py Wed Nov 30 05:13:54 2011
@@ -16,15 +16,17 @@
import os
import os.path
import re
-import sys
-import tempfile
import codecs
+from robot.errors import DataError
from robot.output import LOGGER
-from robot.reporting.jsondatamodel import SeparatingWriter
+from robot.result.serializer import RebotXMLWriter
from robot.version import get_full_version
from robot import utils
+from .jsondatamodel import SeparatingWriter
+from .xunitwriter import XUnitWriter
+
try:
from org.robotframework.RobotRunner import getResourceAsStream
except ImportError: # Occurs unless using robotframework.jar
@@ -58,14 +60,30 @@
_type = 'Output'
def _build(self):
- self._context.result_from_xml.serialize_output(self._path)
+ path = self._path
+ if path == 'NONE':
+ return
+ writer = RebotXMLWriter(path)
+ self._context.result_from_xml.visit(writer)
+ LOGGER.output_file('Output', path)
class XUnitBuilder(_Builder):
_type = 'XUnitFile'
def _build(self):
- self._context.result_from_xml.serialize_xunit(self._path)
+ path = self._path
+ if path == 'NONE':
+ return
+ writer = XUnitWriter(path) # TODO: handle (with atests) error in
opening output file
+ try:
+ self._context.result_from_xml.visit(writer)
+ except:
+ raise DataError("Writing XUnit result file '%s' failed: %s" %
+ (path, utils.get_error_message()))
+ finally:
+ writer.close()
+ LOGGER.output_file('XUnit', path)
class _HTMLFileBuilder(_Builder):
=======================================
--- /src/robot/reporting/resultwriter.py Wed Nov 30 04:51:10 2011
+++ /src/robot/reporting/resultwriter.py Wed Nov 30 05:13:54 2011
@@ -12,16 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from robot.errors import DataError
-from robot.output import LOGGER
from robot.reporting.jsondatamodel import DataModelWriter
-from robot.result.builders import ResultFromXML as RFX
+from robot.result.builders import ResultFromXML
from robot.result.combiningvisitor import CombiningVisitor,
KeywordRemovingVisitor
from robot.result.datamodel import JSModelCreator
-from robot.result.serializer import RebotXMLWriter
-from robot import utils
-
-from robot.reporting.xunitwriter import XUnitWriter
+
from robot.reporting.builders import LogBuilder, ReportBuilder,
XUnitBuilder, OutputBuilder
@@ -38,26 +33,20 @@
if self._data_model is None:
creator = JSModelCreator(log_path=self.settings['Log'],
split_log=self.settings['SplitLog'])
- self.result.visit(CombiningVisitor(creator,
KeywordRemovingVisitor()))
+ self.result_from_xml.visit(CombiningVisitor(creator,
KeywordRemovingVisitor()))
self._data_model = DataModelWriter(creator.datamodel,
creator.split_results)
return self._data_model
@property
def result_from_xml(self):
if self._xml_result is None:
- #TODO: RFX and ResultFromXML name conflict
- execution_result = RFX(*self._data_sources)
+ self._xml_result = ResultFromXML(*self._data_sources)
# TODO: configure and configure_statistics really should be
combined somehow
-
execution_result.configure_statistics(*self.settings.statistics_configuration())
- execution_result.configure(status_rc=not
self.settings['NoStatusRC'],
+
self._xml_result.configure_statistics(*self.settings.statistics_configuration())
+ self._xml_result.configure(status_rc=not
self.settings['NoStatusRC'],
**self.settings.result_configuration())
- self._xml_result = ResultFromXML(execution_result)
return self._xml_result
- @property
- def result(self):
- return self.result_from_xml.result
-
class RobotResultWriter(_ResultWriter):
@@ -76,32 +65,4 @@
XUnitBuilder(self).build()
LogBuilder(self).build()
ReportBuilder(self).build()
- return self.result_from_xml.result
-
-
-class ResultFromXML(object):
-
- def __init__(self, execution_result):
- self.result = execution_result
- self._generator = 'Robot'
-
- def serialize_output(self, path):
- if path == 'NONE':
- return
- serializer = RebotXMLWriter(path)
- self.result.visit(serializer)
- LOGGER.output_file('Output', path)
-
- def serialize_xunit(self, path):
- if path == 'NONE':
- return
- serializer = XUnitWriter(path)
- try:
- self.result.suite.visit(serializer)
- except:
- raise DataError("Writing XUnit result file '%s' failed: %s" %
- (path, utils.get_error_message()))
- finally:
- serializer.close()
- LOGGER.output_file('XUnit', path)
-
+ return self.result_from_xml
=======================================
--- /src/robot/reporting/xunitwriter.py Tue Nov 29 05:15:12 2011
+++ /src/robot/reporting/xunitwriter.py Wed Nov 30 05:13:54 2011
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from robot.result.visitor import SuiteVisitor
+from robot.result.visitor import ResultVisitor
from robot import utils
-class XUnitWriter(SuiteVisitor):
+class XUnitWriter(ResultVisitor):
"""Provides an xUnit-compatible result file.
Attempts to adhere to the de facto schema guessed by Peter Reilly, see: