def runLiveTest(self, test_list=None, run_only=None, debug=False, verbose=False): """ Launch live tests run_only=STRING Run only specified test methods delimited with commas (e.g. testFoo,testBar). This can be regular expressions. debug=boolean Invoke debugger on errors / failures. verbose=boolean Display more information when running tests """ from StringIO import StringIO global global_stream global live_test_running self.serialize() if live_test_running: LOG('ComponentTool', INFO, 'Live test already running') return '' global_stream = StringIO() test_list = self._getCommaSeparatedParameterList(test_list) if not test_list: # no test to run return '' # Allow having strings for verbose and debug verbose = int(verbose) and True or False debug = int(debug) and True or False run_only = self._getCommaSeparatedParameterList(run_only) verbosity = verbose and 2 or 1 request_server_url = self.REQUEST.get('SERVER_URL') try: live_test_running = True from Products.ERP5Type.tests.ERP5TypeLiveTestCase import runLiveTest try: result = runLiveTest(test_list, run_only=run_only, debug=debug, stream=global_stream, request_server_url=request_server_url, verbosity=verbosity) except ImportError: import traceback traceback.print_exc(file=global_stream) global_stream.seek(0) return global_stream.read() finally: live_test_running = False
def runLiveTest(self, test_list=None, run_only=None, debug=False, verbose=False): """ Launch live tests run_only=STRING Run only specified test methods delimited with commas (e.g. testFoo,testBar). This can be regular expressions. debug=boolean Invoke debugger on errors / failures. verbose=boolean Display more information when running tests """ from StringIO import StringIO global global_stream global live_test_running self.serialize() if live_test_running: LOG('ComponentTool', INFO, 'Live test already running') return '' global_stream = StringIO() test_list = self._getCommaSeparatedParameterList(test_list) if not test_list: # no test to run return '' # Allow having strings for verbose and debug verbose = int(verbose) and True or False debug = int(debug) and True or False run_only = self._getCommaSeparatedParameterList(run_only) verbosity = verbose and 2 or 1 request_server_url = self.REQUEST.get('SERVER_URL') try: live_test_running = True from Products.ERP5Type.tests.ERP5TypeLiveTestCase import runLiveTest try: result = runLiveTest(test_list, run_only=run_only, debug=debug, stream=global_stream, request_server_url=request_server_url, verbosity=verbosity) except ImportError: import traceback traceback.print_exc(file=global_stream) global_stream.seek(0) return global_stream.read() finally: live_test_running = False
def runLiveTest(self, test_list=None, run_only=None, debug=False, verbose=False): """ Launch live tests run_only=STRING Run only specified test methods delimited with commas (e.g. testFoo,testBar). This can be regular expressions. debug=boolean Invoke debugger on errors / failures. verbose=boolean Display more informations when running tests """ test_list = self._getCommaSeparatedParameterList(test_list) if not test_list: # no test to run return '' # Allow having strings for verbose and debug verbose = int(verbose) and True or False debug = int(debug) and True or False run_only = self._getCommaSeparatedParameterList(run_only) verbosity = verbose and 2 or 1 from StringIO import StringIO global global_stream global_stream = StringIO() from Products.ERP5Type.tests.ERP5TypeLiveTestCase import runLiveTest try: result = runLiveTest(test_list, run_only=run_only, debug=debug, stream=global_stream, verbosity=verbosity) except ImportError: import traceback traceback.print_exc(file=global_stream) global_stream.seek(0) return global_stream.read()