[devtools] Make timeout error in qunit tests configurable and use SkipTest in test_jscript.py
The reason is that the latter tests quite often fail in our CI environment,
possibly due to concurrent execution of the browser, and this makes it hard to
identify a truly failing build there. So skip tests with a timeout error.
--- a/cubicweb/devtools/qunit.py Fri Nov 18 15:42:10 2016 +0100
+++ b/cubicweb/devtools/qunit.py Fri Nov 18 10:28:41 2016 +0100
@@ -100,6 +100,7 @@
# testfile, (dep_a, dep_b)
all_js_tests = ()
+ timeout_error = RuntimeError
def setUp(self):
super(QUnitTestCase, self).setUp()
@@ -150,6 +151,13 @@
print(logf.read())
raise RuntimeError(*data)
+ def timeout_failure(test_file, timeout, test_count):
+ with open(browser.log_file) as logf:
+ print(logf.read())
+ msg = '%s inactivity timeout (%is). %i test results received' % (
+ test_file, timeout, test_count)
+ raise self.timeout_error(msg)
+
while not error:
try:
result, test_name, msg = self.test_queue.get(timeout=timeout)
@@ -163,8 +171,7 @@
yield test_name, self.fail, (msg, )
except Empty:
error = True
- msg = '%s inactivity timeout (%is). %i test results received'
- yield test_file, runtime_error, (msg % (test_file, timeout, test_count), )
+ yield test_file, timeout_failure, (test_file, timeout, test_count)
if test_count <= 0 and not error:
yield test_name, runtime_error, ('No test yielded by qunit for %s' % test_file, )
--- a/cubicweb/web/test/test_jscript.py Fri Nov 18 15:42:10 2016 +0100
+++ b/cubicweb/web/test/test_jscript.py Fri Nov 18 10:28:41 2016 +0100
@@ -1,3 +1,5 @@
+from unittest import SkipTest
+
from cubicweb.devtools import qunit
from os import path as osp
@@ -5,6 +7,7 @@
class JScript(qunit.QUnitTestCase):
+ timeout_error = SkipTest
all_js_tests = (
("/static/jstests/test_utils.js", (
"/data/cubicweb.js",