--- a/cubicweb/devtools/qunit.py Tue Jan 19 10:03:16 2016 +0100
+++ b/cubicweb/devtools/qunit.py Thu Jan 14 18:35:07 2016 +0100
@@ -25,7 +25,7 @@
from six.moves.queue import Queue, Empty
# imported by default to simplify further import statements
-from logilab.common.testlib import unittest_main, with_tempdir, InnerTest, Tags
+from logilab.common.testlib import unittest_main, with_tempdir, Tags
import webtest.http
import cubicweb
@@ -109,8 +109,9 @@
depends = args[1]
else:
depends = ()
- for js_test in self._test_qunit(test_file, depends):
- yield js_test
+ for name, func, args in self._test_qunit(test_file, depends):
+ with self.subTest(name=name):
+ func(*args)
@with_tempdir
def _test_qunit(self, test_file, depends=(), timeout=10):
@@ -127,8 +128,10 @@
browser.start(self.config['base-url'] + "?vid=qunit")
test_count = 0
error = False
- def raise_exception(cls, *data):
- raise cls(*data)
+
+ def runtime_error(*data):
+ raise RuntimeError(*data)
+
while not error:
try:
result, test_name, msg = self.test_queue.get(timeout=timeout)
@@ -138,18 +141,16 @@
break
test_count += 1
if result:
- yield InnerTest(test_name, lambda : 1)
+ yield test_name, lambda *args: 1, ()
else:
- yield InnerTest(test_name, self.fail, msg)
+ yield test_name, self.fail, (msg, )
except Empty:
error = True
msg = '%s inactivity timeout (%is). %i test results received'
- yield InnerTest(test_file, raise_exception, RuntimeError,
- msg % (test_file, timeout, test_count))
+ yield test_file, runtime_error, (msg % (test_file, timeout, test_count), )
browser.stop()
if test_count <= 0 and not error:
- yield InnerTest(test_name, raise_exception, RuntimeError,
- 'No test yielded by qunit for %s' % test_file)
+ yield test_name, runtime_error, ('No test yielded by qunit for %s' % test_file, )
class QUnitResultController(Controller):