-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`errbot.plugin_manager.instanciateElement` has been deprecated. Fix for loading templates is included. Closes #571
- Loading branch information
Showing
5 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[Core] | ||
name = git_stats | ||
name = GitStats | ||
module = git_stats | ||
|
||
[Documentation] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
from errbot.backends.test import TestBot | ||
from errbot.plugin_info import PluginInfo | ||
from errbot.templating import add_plugin_templates_path | ||
from pathlib import Path | ||
|
||
|
||
def plugin_testbot(klass, loglevel, config=None): | ||
config = config if config else dict() | ||
testbot = TestBot(loglevel=loglevel, extra_config=config) | ||
testbot.start() | ||
plug = testbot.bot.plugin_manager.instanciateElement(klass) | ||
plugin_name = klass.__name__ | ||
plug = klass(testbot.bot, plugin_name) | ||
return plug, testbot | ||
|
||
|
||
def load_templates(plug_file_name): | ||
plugin_info_path = (Path(__file__) | ||
.parent / '..' / 'plugins' / plug_file_name) | ||
with plugin_info_path.open() as plugfile: | ||
plugin_info = PluginInfo.load_file(plugfile, plugin_info_path) | ||
add_plugin_templates_path(plugin_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters