2 new revisions:

Revision: 7473b057b1f8
Author:   Mikko Korpela <[email protected]>
Date:     Fri Jun  3 03:19:44 2011
Log:      use temp file if output not specified and multiple datasources
http://code.google.com/p/robotframework/source/detail?r=7473b057b1f8

Revision: 4dca8408f94f
Author:   Mikko Korpela <[email protected]>
Date:     Fri Jun  3 03:19:59 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=4dca8408f94f

==============================================================================
Revision: 7473b057b1f8
Author:   Mikko Korpela <[email protected]>
Date:     Fri Jun  3 03:19:44 2011
Log:      use temp file if output not specified and multiple datasources
http://code.google.com/p/robotframework/source/detail?r=7473b057b1f8

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

=======================================
--- /src/robot/serializing/testoutput.py        Fri Jun  3 01:44:04 2011
+++ /src/robot/serializing/testoutput.py        Fri Jun  3 03:19:44 2011
@@ -11,6 +11,8 @@
 #  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.
+import os
+import tempfile

 import time

@@ -34,22 +36,39 @@

 class Reporter(object):

-    def execute(self, settings, *data_sources):
-        if len(data_sources) > 1:
-            suite, exec_errors = process_outputs(data_sources, settings)
-            suite.set_options(settings)
- RobotTestOutput(suite, exec_errors, settings).serialize_output('foo.xml')
-            data_sources = ['foo.xml']
-        data_model = jsparser.create_datamodel_from(data_sources[0])
-        report_path = self._parse_file(settings['Report'])
-        log_path = self._parse_file(settings['Log'])
+    def _make_report(self, report_path, log_path, data_model, settings):
         if report_path:
serialize_report(data_model, report_path, settings['ReportTitle'], settings['ReportBackground'], log_path)
             LOGGER.output_file('Report', report_path)
+
+    def _make_log(self, log_path, data_model, settings):
         if log_path:
             serialize_log(data_model, log_path, settings['LogTitle'])
             LOGGER.output_file('Log', log_path)

+    def _combine_outputs(self, data_sources, settings):
+        suite, exec_errors = process_outputs(data_sources, settings)
+        suite.set_options(settings)
+        output_file = self._parse_file(settings['Output'])
+        if output_file is None:
+            _, output_file = tempfile.mkstemp()
+            self._temp_file = output_file
+ RobotTestOutput(suite, exec_errors, settings).serialize_output(output_file)
+        return [output_file]
+
+    def execute(self, settings, *data_sources):
+        self._temp_file = None
+        if len(data_sources) > 1:
+            data_sources = self._combine_outputs(data_sources, settings)
+        data_model = jsparser.create_datamodel_from(data_sources[0])
+        report_path = self._parse_file(settings['Report'])
+        log_path = self._parse_file(settings['Log'])
+        self._make_report(report_path, log_path, data_model, settings)
+        self._make_log(log_path, data_model, settings)
+        if self._temp_file:
+            os.remove(self._temp_file)
+
+
     def _parse_file(self, string):
         return string if string != 'NONE' else None


==============================================================================
Revision: 4dca8408f94f
Author:   Mikko Korpela <[email protected]>
Date:     Fri Jun  3 03:19:59 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=4dca8408f94f


Reply via email to