Commit e4f867d3 authored by Sebastien Robin's avatar Sebastien Robin

add verbose option to runLiveTest

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38417 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a2ce29d
...@@ -1187,7 +1187,8 @@ def initialize( context ): ...@@ -1187,7 +1187,8 @@ def initialize( context ):
instance_home=self._v_instance_home.getPath()) instance_home=self._v_instance_home.getPath())
security.declareProtected(Permissions.ManagePortal, 'runLiveTest') security.declareProtected(Permissions.ManagePortal, 'runLiveTest')
def runLiveTest(self, test_list=[], run_only=None, debug=None): def runLiveTest(self, test_list=[], run_only=None, debug=None,
verbose=False):
""" """
Launch live tests Launch live tests
...@@ -1195,9 +1196,12 @@ def initialize( context ): ...@@ -1195,9 +1196,12 @@ def initialize( context ):
commas (e.g. testFoo,testBar). This can be regular commas (e.g. testFoo,testBar). This can be regular
expressions. expressions.
debug=boolean Invoke debugger on errors / failures. debug=boolean Invoke debugger on errors / failures.
verbose=boolean Display more informations when running tests
""" """
path = os.path.join(getConfiguration().instancehome, 'tests') path = os.path.join(getConfiguration().instancehome, 'tests')
return runLiveTest(test_list, run_only=run_only, debug=debug, path=path) verbosity = verbose and 2 or 1
return runLiveTest(test_list, run_only=run_only, debug=debug, path=path,
verbosity=verbosity)
def getProductList(self): def getProductList(self):
""" List all products """ """ List all products """
......
...@@ -444,7 +444,7 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase): ...@@ -444,7 +444,7 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase):
return ResponseWrapper(response, outstream, path) return ResponseWrapper(response, outstream, path)
def runLiveTest(test_list, **kw): def runLiveTest(test_list, verbosity=1, **kw):
from Products.ERP5Type.tests.runUnitTest import DebugTestResult from Products.ERP5Type.tests.runUnitTest import DebugTestResult
from Products.ERP5Type.tests.runUnitTest import ERP5TypeTestLoader from Products.ERP5Type.tests.runUnitTest import ERP5TypeTestLoader
from Products.ERP5Type.tests import backportUnittest from Products.ERP5Type.tests import backportUnittest
...@@ -475,6 +475,6 @@ def runLiveTest(test_list, **kw): ...@@ -475,6 +475,6 @@ def runLiveTest(test_list, **kw):
stream = StringIO() stream = StringIO()
output = StringIO() output = StringIO()
output.write("**Running Live Test:\n") output.write("**Running Live Test:\n")
result = TestRunner(stream=stream).run(suite) result = TestRunner(stream=output, verbosity=verbosity).run(suite)
output.write(stream.getvalue()) output.write(stream.getvalue())
return output.getvalue() return output.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