diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/plugins/advanced.py | 11 | ||||
-rw-r--r-- | tests/test_advanced.py | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/plugins/advanced.py b/tests/plugins/advanced.py new file mode 100644 index 0000000..19eb051 --- /dev/null +++ b/tests/plugins/advanced.py @@ -0,0 +1,11 @@ +from pluginbase import get_plugin_source + + +def get_app(): + rv = get_plugin_source(stacklevel=1) + if rv is not None: + return rv.app + + +def get_app_name(): + return get_app().name diff --git a/tests/test_advanced.py b/tests/test_advanced.py new file mode 100644 index 0000000..d6440a5 --- /dev/null +++ b/tests/test_advanced.py @@ -0,0 +1,8 @@ +def test_custom_state(base): + class App(object): + name = 'foobar' + source = base.make_plugin_source(searchpath=['./plugins']) + source.app = App() + + plg = source.load_plugin('advanced') + assert plg.get_app_name() == 'foobar' |