From 2227b15247eb988fd39c93cc37986cb5e3a0d542 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Tue, 18 Mar 2014 11:19:17 -0700 Subject: Pass arbitrary keyword args to load_test_app Applications can be written with arbitrary keyword arguments in `setup_app`. The test app builder should support this by allowing arbitrary keyword args to be passed to `load_test_app`, and pass those along to `load_app`. Change-Id: Icb3d5c39d0bf147c1e58732be3199a30a7539f6f --- pecan/core.py | 4 ++-- pecan/testing.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pecan/core.py b/pecan/core.py index b9c88a1..6ab9cef 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -142,7 +142,7 @@ def render(template, namespace): return state.app.render(template, namespace) -def load_app(config): +def load_app(config, **kwargs): ''' Used to load a ``Pecan`` application and its environment based on passed configuration. @@ -158,7 +158,7 @@ def load_app(config): for package_name in getattr(_runtime_conf.app, 'modules', []): module = __import__(package_name, fromlist=['app']) if hasattr(module, 'app') and hasattr(module.app, 'setup_app'): - app = module.app.setup_app(_runtime_conf) + app = module.app.setup_app(_runtime_conf, **kwargs) app.config = _runtime_conf return app raise RuntimeError( diff --git a/pecan/testing.py b/pecan/testing.py index ee2896e..14986ff 100644 --- a/pecan/testing.py +++ b/pecan/testing.py @@ -2,7 +2,7 @@ from pecan import load_app from webtest import TestApp -def load_test_app(config=None): +def load_test_app(config=None, **kwargs): """ Used for functional tests where you need to test your literal application and its integration with the framework. @@ -32,4 +32,4 @@ def load_test_app(config=None): resp = app.get('/path/to/some/resource').status_int assert resp.status_int == 200 """ - return TestApp(load_app(config)) + return TestApp(load_app(config, **kwargs)) -- cgit v1.2.1