2 new revisions:
Revision: 7937c6153379
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 06:44:06 2011
Log: todo
http://code.google.com/p/robotframework/source/detail?r=7937c6153379
Revision: da8264ad9a82
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 07:03:42 2011
Log: log and report writing: 1) handler errors when writing split logs
fail...
http://code.google.com/p/robotframework/source/detail?r=da8264ad9a82
==============================================================================
Revision: 7937c6153379
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 06:44:06 2011
Log: todo
http://code.google.com/p/robotframework/source/detail?r=7937c6153379
Modified:
/src/robot/reporting/jsondatamodel.py
=======================================
--- /src/robot/reporting/jsondatamodel.py Wed Nov 30 06:09:02 2011
+++ /src/robot/reporting/jsondatamodel.py Wed Nov 30 06:44:06 2011
@@ -19,6 +19,8 @@
from robot.reporting.parsingcontext import TextIndex
+# TODO: This class (and module) has too much responsibilities
+
class DataModelWriter(object):
_OUTPUT = 'window.output'
_SETTINGS = 'window.settings'
==============================================================================
Revision: da8264ad9a82
Author: Robot Framework Developers ([email protected])
Date: Wed Nov 30 07:03:42 2011
Log: log and report writing: 1) handler errors when writing split logs
fails, 2) some cleanup
http://code.google.com/p/robotframework/source/detail?r=da8264ad9a82
Modified:
/atest/robot/cli/runner/output_files.txt
/src/robot/reporting/builders.py
=======================================
--- /atest/robot/cli/runner/output_files.txt Fri Jul 8 04:12:06 2011
+++ /atest/robot/cli/runner/output_files.txt Wed Nov 30 07:03:42 2011
@@ -60,9 +60,17 @@
Run Tests --log ${directory} --report ${directory} ${TESTFILE}
Should Be Equal ${SUITE.status} PASS
Check Stderr Matches Regexp SEPARATOR=\n
- ... \\[ ERROR \\] Opening '.*dir.html' failed: .*
- ... \\[ ERROR \\] Opening '.*dir.html' failed: .*
+ ... \\[ ERROR \\] Writing log file '.*dir.html' failed: .*
+ ... \\[ ERROR \\] Writing report file '.*dir.html' failed: .*
Check Stdout Contains Output:
Check Stdout Does Not Contain Log:
Check Stdout Does Not Contain Report:
+Non-writable Split Log
+ Create Directory ${CLI OUTDIR}/dir-1.js
+ Run Tests --splitlog --log ${CLI OUTDIR}/dir.html --report r.html
${TESTFILE}
+ Should Be Equal ${SUITE.status} PASS
+ Check Stderr Matches Regexp \\[ ERROR \\] Writing log
file '.*dir-1.js' failed: .*
+ Check Stdout Contains Output:
+ Check Stdout Does Not Contain Log:
+ Check Stdout Contains Report:
=======================================
--- /src/robot/reporting/builders.py Wed Nov 30 06:12:07 2011
+++ /src/robot/reporting/builders.py Wed Nov 30 07:03:42 2011
@@ -71,35 +71,32 @@
class _HTMLFileBuilder(_Builder):
def _write_file(self, path, template):
- try:
- with codecs.open(path, 'w', encoding='UTF-8') as outfile:
- writer = HTMLFileWriter(outfile, self._model)
- for line in _WebContentFile(template):
- writer.line(line)
- except EnvironmentError, err:
- LOGGER.error("Opening '%s' failed: %s"
- % (err.filename, err.strerror))
- return False
- return True
+ with codecs.open(path, 'w', encoding='UTF-8') as outfile:
+ writer = HTMLFileWriter(outfile, self._model)
+ for line in _WebContentFile(template):
+ writer.line(line)
class LogBuilder(_HTMLFileBuilder):
def build(self, path):
- if self._model._split_results:
- self._write_split_tests(path)
- if self._write_file(path, 'log.html'):
+ try:
+ self._write_file(path, 'log.html')
+ self._write_split_logs_if_needed(path)
+ except EnvironmentError, err:
+ LOGGER.error("Writing log file '%s' failed: %s" %
(err.filename, err.strerror))
+ else:
LOGGER.output_file('Log', path)
- def _write_split_tests(self, path):
- basename = os.path.splitext(path)[0]
+ def _write_split_logs_if_needed(self, path):
+ base = os.path.splitext(path)[0]
for index, (keywords, strings) in
enumerate(self._model._split_results):
index += 1 # enumerate accepts start index only in Py 2.6+
- self._write_test(index, keywords, strings, '%s-%d.js' %
(basename, index))
-
- def _write_test(self, index, keywords, strings, path):
+ self._write_split_log(index, keywords, strings, '%s-%d.js' %
(base, index))
+
+ def _write_split_log(self, index, keywords, strings, path):
with codecs.open(path, 'w', encoding='UTF-8') as outfile:
- writer = SeparatingWriter(outfile, '')
+ writer = SeparatingWriter(outfile)
writer.dump_json('window.keywords%d = ' % index, keywords)
writer.dump_json('window.strings%d = ' % index, strings)
writer.write('window.fileLoading.notify("%s");\n' %
os.path.basename(path))
@@ -108,7 +105,11 @@
class ReportBuilder(_HTMLFileBuilder):
def build(self, path):
- if self._write_file(path, 'report.html'):
+ try:
+ self._write_file(path, 'report.html')
+ except EnvironmentError, err:
+ LOGGER.error("Writing report file '%s' failed: %s" % (path,
err.strerror))
+ else:
LOGGER.output_file('Report', path)