summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2014-03-18 11:19:17 -0700
committerJim Rollenhagen <jim@jimrollenhagen.com>2014-03-18 16:16:26 -0700
commit2227b15247eb988fd39c93cc37986cb5e3a0d542 (patch)
tree86a2c6b8ea070c62a777b921c7dae0f7e5830acd
parentc047087b72d37f094320e3bdff3fc24a79551ea8 (diff)
downloadpecan-2227b15247eb988fd39c93cc37986cb5e3a0d542.tar.gz
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
-rw-r--r--pecan/core.py4
-rw-r--r--pecan/testing.py4
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))