From c811ba8345f490a52edafeeb69a5885f6ba46012 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 9 Jul 2015 09:41:43 +0200 Subject: [PATCH] [IMP] tests: group phantomjs the log to have one python log by javascript log --- openerp/tests/common.py | 8 ++++++-- openerp/tests/phantomtest.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openerp/tests/common.py b/openerp/tests/common.py index 4bd4d069f3f..0ae5adafaf6 100644 --- a/openerp/tests/common.py +++ b/openerp/tests/common.py @@ -297,8 +297,12 @@ class HttpCase(TransactionCase): buf.append(s) # process lines - if '\n' in buf: - line, buf = buf.split('\n', 1) + if '\n' in buf and (not buf.startswith('') or '' in buf): + if buf.startswith(''): + line = buf[12:buf.index('')] + buf = bytearray() + else: + line, buf = buf.split('\n', 1) line = str(line) # relay everything from console.log, even 'ok' or 'error...' lines diff --git a/openerp/tests/phantomtest.js b/openerp/tests/phantomtest.js index 4f264118485..d61d47c9847 100644 --- a/openerp/tests/phantomtest.js +++ b/openerp/tests/phantomtest.js @@ -57,7 +57,7 @@ function PhantomTest() { phantom.exit(1); }; this.page.onConsoleMessage = function(message) { - console.log(message); + console.log(''+message+''); }; this.page.onLoadFinished = function(status) { if (status === "success") { @@ -92,7 +92,7 @@ function PhantomTest() { var message = ("Timeout\nhref: " + window.location.href + "\nreferrer: " + document.referrer + "\n\n" + (document.body && document.body.innerHTML)).replace(/[^a-z0-9\s~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "*"); - console.log('error', message); + console.log('error ' + message + ''); phantom.exit(1); }); }, self.timeout);