Revision: 834588936869
Author:   Robot Framework Developers <[email protected]>
Date:     Mon Jun 13 03:41:55 2011
Log:      testoutput.py closing temp file working in windows
http://code.google.com/p/robotframework/source/detail?r=834588936869

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

=======================================
--- /src/robot/serializing/testoutput.py        Mon Jun 13 01:48:54 2011
+++ /src/robot/serializing/testoutput.py        Mon Jun 13 03:41:55 2011
@@ -64,14 +64,17 @@
     def _combine_outputs(self, data_sources, settings):
         output_file = self._parse_file(settings['Output'])
         if output_file is None:
-            _, output_file = tempfile.mkstemp()
+ handle, output_file = tempfile.mkstemp(suffix='.xml', prefix='rebot-')
+            os.close(handle)
             self._temp_file = output_file
- self._robot_test_output(data_sources, settings).serialize_output(output_file) + self._robot_test_output(data_sources, settings).serialize_output(output_file, log=not self._temp_file)
         return [output_file]

     def execute_rebot(self, settings, *data_sources):
         data_sources = self._combine_outputs(data_sources, settings)
         self.execute(settings, *data_sources)
+        if self._temp_file:
+            os.remove(self._temp_file)

     def execute(self, settings, *data_sources):
         data_model = jsparser.create_datamodel_from(data_sources[0])
@@ -82,8 +85,6 @@
         self._make_report(report_path, log_path, data_model, settings)
         xunit_path = self._parse_file(settings['XUnitFile'])
         self._make_xunit(xunit_path, data_sources, settings)
-        if self._temp_file:
-            os.remove(self._temp_file)

     def _parse_file(self, string):
         return string if string != 'NONE' else None
@@ -115,7 +116,7 @@
         LOGGER.output_file('Log', settings['Log'])
         self.serialize_xunit(settings['XUnitFile'])

-    def serialize_output(self, path, split=-1):
+    def serialize_output(self, path, split=-1, log=True):
         if path == 'NONE':
             return
         serializer = OutputSerializer(path, split)
@@ -123,7 +124,8 @@
         self.statistics.serialize(serializer)
         self.exec_errors.serialize(serializer)
         serializer.close()
-        LOGGER.output_file('Output', path)
+        if log:
+            LOGGER.output_file('Output', path)

     def serialize_xunit(self, path):
         if path == 'NONE':

Reply via email to