# HG changeset patch # User Rémi Cardona # Date 1450698455 -3600 # Node ID 3dfed980071ca58869e5a24fbe6eadd32b9ed696 # Parent d04703f545102bcd6a21ebe763a8686bcf7c662a [devtools] Use super() in TestServerConfiguration.__init__() While cleaning up the use of init_config() in WSGIAppTC, I wondered why the method was trying to set the 'https_uiprops' and 'https_datadir_url' attributes on the config, when WebConfiguration's __init__ should be taking care of setting them. WSGIAppTC uses the default configuration - one that derives from ApptestConfiguration (noted as G below). The issue is that the class hierarchy of ApptestConfiguration includes TestServerConfiguration (C in the graph below) which calls ServerConfiguration's __init__ directly (B below). As B does not have an __init__ method, CubicWebConfiguration's __init__ is called directly (A below). This has the unintended consequence of preventing WebConfiguration's __init__ from being called. A / \ B D | | C E \ / F | G | ... A: cwconfig.CubicWebConfiguration B: server.serverconfig.ServerConfiguration C: devtools.TestServerConfiguration D: web.webconfig.WebConfiguration E: etwist.twconfig.WebConfigurationBase F: devtools.BaseApptestConfiguration G: devtools.ApptestConfiguration NB: unittest_wsgi wasn't really broken, as it's the only test in wsgi/test/, but I figured I might as well clean it up. Related to #9297611. diff -r d04703f54510 -r 3dfed980071c devtools/__init__.py --- a/devtools/__init__.py Mon Dec 21 10:08:13 2015 +0100 +++ b/devtools/__init__.py Mon Dec 21 12:47:35 2015 +0100 @@ -151,7 +151,7 @@ else: # cube test apphome = abspath('..') self._apphome = apphome - ServerConfiguration.__init__(self, appid) + super(TestServerConfiguration, self).__init__(appid) self.init_log(log_threshold, force=True) # need this, usually triggered by cubicweb-ctl self.load_cwctl_plugins() diff -r d04703f54510 -r 3dfed980071c wsgi/test/unittest_wsgi.py --- a/wsgi/test/unittest_wsgi.py Mon Dec 21 10:08:13 2015 +0100 +++ b/wsgi/test/unittest_wsgi.py Mon Dec 21 12:47:35 2015 +0100 @@ -110,12 +110,6 @@ req = CubicWebWsgiRequest(r.environ, self.vreg) self.assertEqual(u"é", req.form['arg']) - @classmethod - def init_config(cls, config): - super(WSGIAppTC, cls).init_config(config) - config.https_uiprops = None - config.https_datadir_url = None - if __name__ == '__main__': import unittest