3 new revisions:

Revision: cae2a45af5c7
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:35:47 2011
Log:      whitespace
http://code.google.com/p/robotframework/source/detail?r=cae2a45af5c7

Revision: b946eb5a4e07
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:37:01 2011
Log:      allow using NONE to disable output generation...
http://code.google.com/p/robotframework/source/detail?r=b946eb5a4e07

Revision: 627077bdb4f3
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:37:16 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg
http://code.google.com/p/robotframework/source/detail?r=627077bdb4f3

==============================================================================
Revision: cae2a45af5c7
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:35:47 2011
Log:      whitespace
http://code.google.com/p/robotframework/source/detail?r=cae2a45af5c7

Modified:
 /src/robot/serializing/testoutput.py

=======================================
--- /src/robot/serializing/testoutput.py        Sun Feb  6 01:24:10 2011
+++ /src/robot/serializing/testoutput.py        Thu May 19 23:35:47 2011
@@ -80,7 +80,7 @@
         outfile = self._get_outfile(path, 'summary')
         if not outfile:
             return
-        self._use_template(outfile, templates.REPORT,
+        self._use_template(outfile, templates.REPORT,
                            title or '%s Summary Report' % self.suite.name,
                            self._get_background_color(background))
         self.statistics.serialize(SummaryStatSerializer(outfile))
@@ -111,7 +111,7 @@
         outfile = self._get_outfile(path, 'report')
         if not outfile:
             return
-        self._use_template(outfile, templates.REPORT,
+        self._use_template(outfile, templates.REPORT,
                            title or '%s Test Report' % self.suite.name,
                            self._get_background_color(background))
         self.statistics.serialize(ReportStatSerializer(outfile))

==============================================================================
Revision: b946eb5a4e07
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:37:01 2011
Log:      allow using NONE to disable output generation

Update issue 829

Code and tests done, userguide still needs to be updated
http://code.google.com/p/robotframework/source/detail?r=b946eb5a4e07

Modified:
 /atest/robot/cli/runner/cli_resource.txt
 /atest/robot/cli/runner/output_files.txt
 /src/robot/conf/settings.py
 /src/robot/runner.py
 /src/robot/utils/xmlwriter.py

=======================================
--- /atest/robot/cli/runner/cli_resource.txt    Mon Apr 12 05:29:55 2010
+++ /atest/robot/cli/runner/cli_resource.txt    Thu May 19 23:37:01 2011
@@ -21,7 +21,10 @@
 Output Directory Should Contain  [Arguments]  @{expected}
     Directory Should Contain  ${CLI OUTDIR}  @{expected}

-Run Some Tests  [Arguments]  ${options}=-l none -r none
+Output Directory Should Be Empty
+    Directory Should Be Empty  ${CLI OUTDIR}
+
+Run Some Tests  [Arguments]  ${options}=-l none -r none
     ${path} =  Join Path  ${CURDIR}/../../..  testdata  ${TESTFILE}
     ${output} =  Run Robot Directly  -d ${CLI OUTDIR} ${options} ${path}
Should Contain ${output} Output: message=Running tests failed for some reason
=======================================
--- /atest/robot/cli/runner/output_files.txt    Thu Apr  8 08:11:28 2010
+++ /atest/robot/cli/runner/output_files.txt    Thu May 19 23:37:01 2011
@@ -24,10 +24,11 @@

 Output None
Run Tests Without Processing Output --outputdir ${CLI OUTDIR} -o NONE -r None -l none ${TESTFILE}
-    Output Directory Should Contain  NONE.xml
-    File Should Not Exist  NONE
-    File Should Not Exist  None
-    File Should Not Exist  none
+    Output Directory Should Be Empty
+
+Debugfile Can Be Created When Output Is NONE
+ Run Tests Without Processing Output --outputdir ${CLI OUTDIR} -o NONE -r report.html -b debug.txt ${TESTFILE}
+    Output Directory Should Contain  debug.txt

 All Outputs
Run Tests Without Processing Output --outputdir=${CLI OUTDIR} --output=myoutput.xml --report=myreport.html --log=mylog.html -S mysummary.html ${TESTFILE}
=======================================
--- /src/robot/conf/settings.py Mon Apr 18 07:59:36 2011
+++ /src/robot/conf/settings.py Thu May 19 23:37:01 2011
@@ -50,6 +50,7 @@
                   'NoStatusRC'       : ('nostatusrc', False),
                   'MonitorWidth'     : ('monitorwidth', 78),
                   'MonitorColors'    : ('monitorcolors', 'AUTO') }
+ _output_opts = ['Output', 'Log', 'Report', 'Summary', 'DebugFile', 'XUnitFile']
     _deprecated = {}

     def __init__(self, options={}, log=True):
@@ -94,7 +95,7 @@
             return [v.replace('_', ' ') for v in value]
         if name in ['Include', 'Exclude', 'TagStatCombine']:
             return [item.replace('AND', '&') for item in value]
-        if name in self._optional_outputs and utils.eq(value, 'NONE'):
+        if name in self._output_opts and utils.eq(value, 'NONE'):
             return 'NONE'
         if name == 'OutputDir':
             return utils.normpath(value)
@@ -109,20 +110,21 @@
         return value

     def __getitem__(self, name):
-        if not self._cli_opts.has_key(name):
+        if name not in self._cli_opts:
             raise KeyError("Non-existing setting '%s'" % name)
- elif name in ['Output', 'Log', 'Report', 'Summary', 'DebugFile', 'XUnitFile']:
+        if name in self._output_opts:
             return self._get_output_file(name)
         return self._opts[name]

     def _get_output_file(self, type_):
- """Returns path of the requested ouput file and creates needed dirs.
-
- Type can be 'Output', 'Log', 'Report', 'Summary', 'DebugFile' or 'XUnitFile'. + """Returns path of the requested output file and creates needed dirs.
+
+        `type_` can be 'Output', 'Log', 'Report', 'Summary', 'DebugFile'
+        or 'XUnitFile'.
         """
         name = self._opts[type_]
-        if name == 'NONE' and type_ in self._optional_outputs:
-            return name
+        if self._outputfile_disabled(type_, name):
+            return 'NONE'
         name = self._process_output_name(name, type_)
         path = utils.normpath(os.path.join(self['OutputDir'], name), False)
         self._create_output_dir(os.path.dirname(path), type_)
@@ -197,7 +199,6 @@
                         'VariableFiles' : ('variablefile', []),
                         'Listeners'     : ('listener', []),
                         'DebugFile'     : ('debugfile', 'NONE'),}
- _optional_outputs = ['Log', 'Report', 'Summary', 'DebugFile', 'XUnitFile']

     def is_rebot_needed(self):
return not ('NONE' == self['Log'] == self['Report'] == self['Summary'] == self['XUnitFile'])
@@ -217,6 +218,11 @@
         settings._opts['LogLevel'] = 'TRACE'
         return datasources, settings

+    def _outputfile_disabled(self, type_, name):
+        if name == 'NONE':
+            return True
+        return self._opts['Output'] == 'NONE' and type_ != 'DebugFile'
+

 class RebotSettings(_BaseSettings):
     _extra_cli_opts = { 'Output'         : ('output', 'NONE'),
@@ -224,4 +230,6 @@
                         'RemoveKeywords' : ('removekeywords', 'NONE'),
                         'StartTime'      : ('starttime', 'N/A'),
                         'EndTime'        : ('endtime', 'N/A')}
-    _optional_outputs = ['Output', 'Log', 'Report', 'Summary', 'XUnitFile']
+
+    def _outputfile_disabled(self, type_, name):
+        return name == 'NONE'
=======================================
--- /src/robot/runner.py        Mon Apr 18 21:23:22 2011
+++ /src/robot/runner.py        Thu May 19 23:37:01 2011
@@ -135,10 +135,12 @@
as an absolute path. Other output files are created from XML output file after the test execution and XML output can also be further processed with Rebot tool
-                          (e.g. combined with other XML output files).
+ (e.g. combined with other XML output files). Can be + disabled by giving a special value 'NONE'. In this + case, also log and report are automatically disabled.
                           Default: output.xml
-l --log file HTML log file. Can be disabled by giving a special
-                          name 'NONE'. Default: log.html
+                          value 'NONE'. Default: log.html
                           Examples: '--log mylog.html', '-l NONE'
  -r --report file         HTML report file. Can be disabled with 'NONE'
                           similarly as --log. Default: report.html
=======================================
--- /src/robot/utils/xmlwriter.py       Sun Feb  6 01:24:10 2011
+++ /src/robot/utils/xmlwriter.py       Thu May 19 23:37:01 2011
@@ -12,10 +12,21 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-
 import os

-if os.name == 'java':
-    from jyxmlwriter import XmlWriter
-else:
-    from pyxmlwriter import XmlWriter
+from abstractxmlwriter import AbstractXmlWriter
+
+
+def XmlWriter(path):
+    if path == 'NONE':
+        return FakeXMLWriter()
+    if os.name == 'java':
+        from jyxmlwriter import XmlWriter
+    else:
+        from pyxmlwriter import XmlWriter
+    return XmlWriter(path)
+
+
+class FakeXMLWriter(AbstractXmlWriter):
+    closed = False
+    _start = _content = _end = _close = lambda self, *args: None

==============================================================================
Revision: 627077bdb4f3
Author:   Janne Härkönen <[email protected]>
Date:     Thu May 19 23:37:16 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg
http://code.google.com/p/robotframework/source/detail?r=627077bdb4f3


Reply via email to