Add support for local (in-repo, non-setuptools) plugins.

Closes #357
This commit is contained in:
Carl Meyer 2017-08-03 00:25:37 -07:00
parent 6df26ffd57
commit 4e58068657
15 changed files with 391 additions and 133 deletions

View file

@ -48,3 +48,15 @@ def test_handles_mapping_functions_across_plugins(iter_entry_points):
plugins = [plugin_mgr.plugins[name] for name in plugin_mgr.names]
assert list(plugin_mgr.map(lambda x: x)) == plugins
@mock.patch('pkg_resources.iter_entry_points')
def test_local_plugins(iter_entry_points):
"""Verify PluginManager can load given local plugins."""
iter_entry_points.return_value = []
plugin_mgr = manager.PluginManager(
namespace='testing.pkg_resources',
local_plugins=['X = path.to:Plugin']
)
assert plugin_mgr.plugins['X'].entry_point.module_name == 'path.to'