Commit e3c10abe authored by Nicolas Dumazet's avatar Nicolas Dumazet

test runner: use subprocess instead of os.popen


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dde8fd74
...@@ -52,6 +52,7 @@ from base64 import b64encode, b64decode ...@@ -52,6 +52,7 @@ from base64 import b64encode, b64decode
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
from zLOG import LOG, INFO from zLOG import LOG, INFO
from base64 import decodestring from base64 import decodestring
import subprocess
WIN = os.name == 'nt' WIN = os.name == 'nt'
...@@ -452,16 +453,17 @@ class TemplateTool (BaseTool): ...@@ -452,16 +453,17 @@ class TemplateTool (BaseTool):
outfile = StringIO() outfile = StringIO()
if RESPONSE is not None: if RESPONSE is not None:
RESPONSE.setHeader('Content-type', 'text/plain') RESPONSE.setHeader('Content-type', 'text/plain')
process = os.popen('%s %s %s 2>&1' test_cmd_args = [sys.executable, getUnitTestFile()]
% (sys.executable, test_cmd_args += test_list
getUnitTestFile(), process = subprocess.Popen(test_cmd_args,
' '.join(test_list))) stdout=subprocess.PIPE,
while 1: stderr=subprocess.STDOUT)
try:
outfile.write(process.next()) output = process.communicate()[0]
outfile.write(output)
outfile.flush() outfile.flush()
except StopIteration:
break
if hasattr(outfile, 'getvalue'): if hasattr(outfile, 'getvalue'):
return outfile.getvalue() return outfile.getvalue()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment