# HG changeset patch # User Julien Cristau # Date 1448544218 -3600 # Node ID f7179ecfbae0bf9524c1ff582d819e55d421f730 # Parent 4861d387a519c3d300a339787017099423a88bc1 [qunit] move from CubicWebServerTC to CubicWebTestTC This test now uses wsgi instead of twisted, and thus passes under python3. diff -r 4861d387a519 -r f7179ecfbae0 devtools/qunit.py --- a/devtools/qunit.py Thu Nov 26 14:37:06 2015 +0100 +++ b/devtools/qunit.py Thu Nov 26 14:23:38 2015 +0100 @@ -15,6 +15,7 @@ # # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . +from __future__ import absolute_import import os, os.path as osp import errno @@ -25,12 +26,13 @@ # imported by default to simplify further import statements from logilab.common.testlib import unittest_main, with_tempdir, InnerTest, Tags +import webtest.http import cubicweb from cubicweb.view import View from cubicweb.web.controller import Controller from cubicweb.web.views.staticcontrollers import StaticFileController, STATIC_CONTROLLERS -from cubicweb.devtools.httptest import CubicWebServerTC +from cubicweb.devtools import webtest as cwwebtest class FirefoxHelper(object): @@ -72,9 +74,9 @@ self.stop() -class QUnitTestCase(CubicWebServerTC): +class QUnitTestCase(cwwebtest.CubicWebTestTC): - tags = CubicWebServerTC.tags | Tags(('qunit',)) + tags = cwwebtest.CubicWebTestTC.tags | Tags(('qunit',)) # testfile, (dep_a, dep_b) all_js_tests = () @@ -86,15 +88,18 @@ tc = self test_queue = self.test_queue self._qunit_controller = MyQUnitResultController - self.vreg.register(MyQUnitResultController) - self.vreg.register(QUnitView) - self.vreg.register(CWDevtoolsStaticController) + self.webapp.app.appli.vreg.register(MyQUnitResultController) + self.webapp.app.appli.vreg.register(QUnitView) + self.webapp.app.appli.vreg.register(CWDevtoolsStaticController) + self.server = webtest.http.StopableWSGIServer.create(self.webapp.app) + self.config.global_set_option('base-url', self.server.application_url) def tearDown(self): + self.server.shutdown() + self.webapp.app.appli.vreg.unregister(self._qunit_controller) + self.webapp.app.appli.vreg.unregister(QUnitView) + self.webapp.app.appli.vreg.unregister(CWDevtoolsStaticController) super(QUnitTestCase, self).tearDown() - self.vreg.unregister(self._qunit_controller) - self.vreg.unregister(QUnitView) - self.vreg.unregister(CWDevtoolsStaticController) def test_javascripts(self): for args in self.all_js_tests: @@ -205,20 +210,15 @@ def call(self, **kwargs): w = self.w req = self._cw - data = { - 'jquery': req.data_url('jquery.js'), - 'devtools': req.build_url('devtools'), - } w(u''' - - - - ''' - % data) + + + + ''') w(u'') w(u'