# HG changeset patch # User Christophe de Vienne # Date 1430211843 -7200 # Node ID a6547ff97ce017d180bc82c65cebef05973f78e7 # Parent f9473eb6a8a9a3187bec6bd0069871874c6d07a5 Allow tests to override pyramid_settings Closes #5307426 diff -r f9473eb6a8a9 -r a6547ff97ce0 pyramid_cubicweb/__init__.py --- a/pyramid_cubicweb/__init__.py Wed Apr 29 11:39:35 2015 +0200 +++ b/pyramid_cubicweb/__init__.py Tue Apr 28 11:04:03 2015 +0200 @@ -12,7 +12,7 @@ from ConfigParser import SafeConfigParser -def make_cubicweb_application(cwconfig): +def make_cubicweb_application(cwconfig, settings=None): """ Create a pyramid-based CubicWeb instance from a cubicweb configuration. @@ -23,7 +23,7 @@ """ settings_filenames = [os.path.join(cwconfig.apphome, 'pyramid.ini')] - settings = {} + settings = dict(settings) if settings else {} if cwconfig.debugmode: settings_filenames.insert( diff -r f9473eb6a8a9 -r a6547ff97ce0 pyramid_cubicweb/tests/__init__.py --- a/pyramid_cubicweb/tests/__init__.py Wed Apr 29 11:39:35 2015 +0200 +++ b/pyramid_cubicweb/tests/__init__.py Tue Apr 28 11:04:03 2015 +0200 @@ -6,6 +6,8 @@ class PyramidCWTest(CubicWebTestTC): + settings = {} + @classmethod def init_config(cls, config): super(PyramidCWTest, cls).init_config(config) @@ -17,7 +19,7 @@ def setUp(self): # Skip CubicWebTestTC setUp super(CubicWebTestTC, self).setUp() - config = make_cubicweb_application(self.config) + config = make_cubicweb_application(self.config, self.settings) self.includeme(config) self.pyr_registry = config.registry self.webapp = webtest.TestApp(config.make_wsgi_app())