Skip to content

Commit

Permalink
requirements.txt: Update Errbot
Browse files Browse the repository at this point in the history
`errbot.plugin_manager.instanciateElement` has
been deprecated. Fix for loading templates is
included.

Closes #571
  • Loading branch information
nvzard committed Jul 29, 2018
1 parent fcfbf85 commit b0c095c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .moban.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: corobo

dependencies:
- pyopenssl
- git+https://github.com/errbotio/errbot@c2639879d4c298933cdf406193de5a5e626db12b
- git+https://github.com/errbotio/errbot@a0f35732484c8c0692e123c48653517cffa21a42
- wolframalpha
- github3.py~=1.0.0
- IGitt==0.4.1.dev20180317153318
Expand Down
2 changes: 1 addition & 1 deletion plugins/git_stats.plug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Core]
name = git_stats
name = GitStats
module = git_stats

[Documentation]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyopenssl
git+https://github.com/errbotio/errbot@c2639879d4c298933cdf406193de5a5e626db12b
git+https://github.com/errbotio/errbot@a0f35732484c8c0692e123c48653517cffa21a42
wolframalpha
github3.py~=1.0.0
IGitt==0.4.1.dev20180317153318
Expand Down
14 changes: 13 additions & 1 deletion tests/helper.py
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)
3 changes: 2 additions & 1 deletion tests/labhub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import plugins.labhub
from plugins.labhub import LabHub

from tests.helper import plugin_testbot
from tests.helper import load_templates, plugin_testbot


class TestLabHub(unittest.TestCase):

def setUp(self):
load_templates('labhub.plug')
plugins.labhub.github3 = create_autospec(github3)

self.mock_org = create_autospec(github3.orgs.Organization)
Expand Down

0 comments on commit b0c095c

Please sign in to comment.