From 726957c85049579886bcf3c02a96a05568e8c60e Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Thu, 8 Nov 2012 15:10:15 +0900
Subject: [PATCH] Store Live Tests log in INSTANCEHOME/var rather than in a
 StringIO.

This avoids copying/pasting the content of the form and also keep records for
later inspection.
---
 product/ERP5Type/Tool/ClassTool.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/Tool/ClassTool.py b/product/ERP5Type/Tool/ClassTool.py
index 450f22aa73..0bad31e091 100644
--- a/product/ERP5Type/Tool/ClassTool.py
+++ b/product/ERP5Type/Tool/ClassTool.py
@@ -38,7 +38,6 @@ from Products.CMFCore.utils import UniqueObject
 
 import OFS
 import transaction
-from cStringIO import StringIO
 from zExceptions import BadRequest
 from zExceptions import Unauthorized
 from Acquisition import Implicit
@@ -1223,8 +1222,14 @@ def initialize( context ):
           return ''
         path = os.path.join(getConfiguration().instancehome, 'tests')
         verbosity = verbose and 2 or 1
+
+        from datetime import datetime
+        log_filename = 'live-test-%s.log' % datetime.now().strftime('%Y%m%d-%H%M%S')
+
         global global_stream
-        global_stream = StringIO()
+        global_stream = open(os.path.join(getConfiguration().instancehome,
+                                          'var', log_filename), 'w+')
+
         from Products.ERP5Type.tests.ERP5TypeLiveTestCase import runLiveTest
         try:
           result = runLiveTest(test_list,
-- 
2.30.9