4 new revisions:
Revision: ae174c8b7665
Author: Pekka Klärck
Date: Mon Jun 25 06:08:51 2012
Log: XUnitWriter: Avoid instantiating objects in __init__. This allows
furt...
http://code.google.com/p/robotframework/source/detail?r=ae174c8b7665
Revision: 68d6fb73b44d
Author: Pekka Klärck
Date: Mon Jun 25 07:16:13 2012
Log: tiny test cleanup
http://code.google.com/p/robotframework/source/detail?r=68d6fb73b44d
Revision: da5885c34ba3
Author: Pekka Klärck
Date: Mon Jun 25 07:41:07 2012
Log: ResultWriter: Show more information if writing outputs fails due
to En...
http://code.google.com/p/robotframework/source/detail?r=da5885c34ba3
Revision: f3e209fc1b04
Author: Pekka Klärck
Date: Mon Jun 25 07:41:23 2012
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=f3e209fc1b04
==============================================================================
Revision: ae174c8b7665
Author: Pekka Klärck
Date: Mon Jun 25 06:08:51 2012
Log: XUnitWriter: Avoid instantiating objects in __init__. This allows
further cleanup in resultwriter.
http://code.google.com/p/robotframework/source/detail?r=ae174c8b7665
Modified:
/src/robot/reporting/resultwriter.py
/src/robot/reporting/xunitwriter.py
=======================================
--- /src/robot/reporting/resultwriter.py Tue May 22 03:28:25 2012
+++ /src/robot/reporting/resultwriter.py Mon Jun 25 06:08:51 2012
@@ -50,7 +50,7 @@
def _write_xunit(self, result, path):
try:
- result.visit(XUnitWriter(path))
+ XUnitWriter(result).write(path)
except EnvironmentError, err:
LOGGER.error("Opening XUnit result file '%s' failed: %s"
% (path, err.strerror))
=======================================
--- /src/robot/reporting/xunitwriter.py Mon Jun 18 03:47:07 2012
+++ /src/robot/reporting/xunitwriter.py Mon Jun 25 06:08:51 2012
@@ -18,15 +18,25 @@
from robot.utils import XmlWriter
-class XUnitWriter(ResultVisitor):
+class XUnitWriter(object):
+
+ def __init__(self, execution_result):
+ self._execution_result = execution_result
+
+ def write(self, output):
+ writer = XUnitFileWriter(XmlWriter(output, encoding='UTF-8'))
+ self._execution_result.visit(writer)
+
+
+class XUnitFileWriter(ResultVisitor):
"""Provides an xUnit-compatible result file.
Attempts to adhere to the de facto schema guessed by Peter Reilly, see:
http://marc.info/?l=ant-dev&m=123551933508682
"""
- def __init__(self, output):
- self._writer = XmlWriter(output, encoding='UTF-8')
+ def __init__(self, xml_writer):
+ self._writer = xml_writer
self._root_suite = None
def start_suite(self, suite):
==============================================================================
Revision: 68d6fb73b44d
Author: Pekka Klärck
Date: Mon Jun 25 07:16:13 2012
Log: tiny test cleanup
http://code.google.com/p/robotframework/source/detail?r=68d6fb73b44d
Modified:
/atest/robot/cli/runner/output_files.txt
=======================================
--- /atest/robot/cli/runner/output_files.txt Wed Jun 6 21:39:55 2012
+++ /atest/robot/cli/runner/output_files.txt Mon Jun 25 07:16:13 2012
@@ -33,8 +33,7 @@
Output Directory Should Contain mylog.html myoutput.xml
myreport.html
All Outputs With Default Names
- ${path} = Join Path ${CURDIR}/../../.. testdata ${TESTFILE}
- Run Robot Directly --outputdir ${CLI OUTDIR} ${path}
+ Run Robot Directly --outputdir ${CLI OUTDIR} ${DATADIR}${/}${TESTFILE}
Output Directory Should Contain log.html output.xml report.html
All Outputs Without Extensions
@@ -57,7 +56,7 @@
Check Stderr Matches Regexp \\[ ERROR \\] Opening output
file '.*diréctöry.xml' failed: .*${USAGE_TIP}
Non-writable Log and Report
- ${directory} = Join Path ${CLI OUTDIR}/diréctöry.html
+ ${directory} = Normalize Path ${CLI OUTDIR}/diréctöry.html
Create Directory ${directory}
Run Tests --log ${directory} --report ${directory} ${TESTFILE}
Should Be Equal ${SUITE.status} PASS
==============================================================================
Revision: da5885c34ba3
Author: Pekka Klärck
Date: Mon Jun 25 07:41:07 2012
Log: ResultWriter: Show more information if writing outputs fails due
to EnvironmentError
Also cleaned up the error handling code.
Update issue 1165
Status: Done
Now also the file that actually caused the error is shown in the error
message.
http://code.google.com/p/robotframework/source/detail?r=da5885c34ba3
Modified:
/atest/robot/output/xunit.txt
/atest/robot/rebot/xunit.txt
/src/robot/reporting/resultwriter.py
=======================================
--- /atest/robot/output/xunit.txt Mon Jun 18 03:52:34 2012
+++ /atest/robot/output/xunit.txt Mon Jun 25 07:41:07 2012
@@ -48,7 +48,7 @@
${dir} ${base} = Split Path ${INVALID}
${path} = Regexp Escape ${INVALID}
Check Stderr Matches Regexp
- ... \\[ ERROR \\] Opening XUnit result file '${path}' failed: .*
+ ... \\[ ERROR \\] Writing xunit file '${path}' failed: .*
*** Keywords ***
Get XUnit Node
=======================================
--- /atest/robot/rebot/xunit.txt Mon Jun 18 02:09:56 2012
+++ /atest/robot/rebot/xunit.txt Mon Jun 25 07:41:07 2012
@@ -42,7 +42,7 @@
File Should Exist ${OUTDIR}/log.html
${path} = Regexp Escape ${INVALID}
Check Stderr Matches Regexp
- ... \\[ ERROR \\] Opening XUnit result file '${path}' failed: .*
+ ... \\[ ERROR \\] Writing xunit file '${path}' failed: .*
*** Keywords ***
Create Input File
=======================================
--- /src/robot/reporting/resultwriter.py Mon Jun 25 06:08:51 2012
+++ /src/robot/reporting/resultwriter.py Mon Jun 25 07:41:07 2012
@@ -15,6 +15,7 @@
from robot.errors import DataError
from robot.output import LOGGER
from robot.result import ExecutionResult
+from robot.utils import unic
from .jsmodelbuilders import JsModelBuilder
from .logreportwriters import LogWriter, ReportWriter
@@ -41,39 +42,30 @@
return results.return_code
def _write_output(self, result, path):
- try:
- result.save(path)
- except DataError, err:
- LOGGER.error(unicode(err))
- else:
- LOGGER.output_file('Output', path)
+ self._write('Output', result.save, path)
def _write_xunit(self, result, path):
- try:
- XUnitWriter(result).write(path)
- except EnvironmentError, err:
- LOGGER.error("Opening XUnit result file '%s' failed: %s"
- % (path, err.strerror))
- else:
- LOGGER.output_file('XUnit', path)
+ self._write('XUnit', XUnitWriter(result).write, path)
def _write_log(self, js_result, path, config):
- try:
- LogWriter(js_result).write(path, config)
- except EnvironmentError, err:
- # Cannot use err.filename due to
http://bugs.jython.org/issue1825
- # and thus error has wrong file name if writing split log
fails.
- LOGGER.error("Writing log file '%s' failed: %s" % (path,
err.strerror))
- else:
- LOGGER.output_file('Log', path)
+ self._write('Log', LogWriter(js_result).write, path, config)
def _write_report(self, js_result, path, config):
+ self._write('Report', ReportWriter(js_result).write, path, config)
+
+ def _write(self, name, writer, path, *args):
try:
- ReportWriter(js_result).write(path, config)
+ writer(path, *args)
+ except DataError, err:
+ LOGGER.error(unicode(err))
except EnvironmentError, err:
- LOGGER.error("Writing report file '%s' failed: %s" % (path,
err.strerror))
+ # `err.filename` can be different than `path` at least if
reading
+ # log/report templates or writing split log fails.
+ # `unic` is needed due to http://bugs.jython.org/issue1825.
+ LOGGER.error("Writing %s file '%s' failed: %s: %s" %
+ (name.lower(), path, err.strerror,
unic(err.filename)))
else:
- LOGGER.output_file('Report', path)
+ LOGGER.output_file(name, path)
class Results(object):
==============================================================================
Revision: f3e209fc1b04
Author: Pekka Klärck
Date: Mon Jun 25 07:41:23 2012
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=f3e209fc1b04