[Erp5-report] r29605 - /erp5/trunk/products/ERP5/Tool/TemplateTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 13 16:38:19 CEST 2009
Author: nicolas.dumazet
Date: Tue Oct 13 16:38:17 2009
New Revision: 29605
URL: http://svn.erp5.org?rev=29605&view=rev
Log:
test runner: use subprocess instead of os.popen
Modified:
erp5/trunk/products/ERP5/Tool/TemplateTool.py
Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=29605&r1=29604&r2=29605&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] Tue Oct 13 16:38:17 2009
@@ -52,6 +52,7 @@
from Products.ERP5Type.Message import translateString
from zLOG import LOG, INFO
from base64 import decodestring
+import subprocess
WIN = os.name == 'nt'
@@ -452,16 +453,17 @@
outfile = StringIO()
if RESPONSE is not None:
RESPONSE.setHeader('Content-type', 'text/plain')
- process = os.popen('%s %s %s 2>&1'
- % (sys.executable,
- getUnitTestFile(),
- ' '.join(test_list)))
- while 1:
- try:
- outfile.write(process.next())
- outfile.flush()
- except StopIteration:
- break
+ test_cmd_args = [sys.executable, getUnitTestFile()]
+ test_cmd_args += test_list
+ process = subprocess.Popen(test_cmd_args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+
+ output = process.communicate()[0]
+
+ outfile.write(output)
+ outfile.flush()
+
if hasattr(outfile, 'getvalue'):
return outfile.getvalue()
More information about the Erp5-report
mailing list