Skip to content

Commit

Permalink
Rename load_path to load_plugin (#2947)
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored Aug 7, 2016
1 parent e5b7eda commit dee28d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def task_configuration_error(flag_name):

plugin_loader = PluginLoader()
for plugin in config.plugins:
plugin_loader.load_path(plugin)
plugin_loader.load_plugin(plugin)

# create web dir if not exists
try:
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _get_correct_path(self, path):

return correct_path

def load_path(self, path):
def load_plugin(self, path):
correct_path = self._get_correct_path(path)

if correct_path not in self.folder_cache:
Expand Down
4 changes: 2 additions & 2 deletions pokemongo_bot/test/plugin_loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ def setUp(self):

def test_load_namespace_class(self):
package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'resources', 'plugin_fixture')
self.plugin_loader.load_path(package_path)
self.plugin_loader.load_plugin(package_path)
loaded_class = self.plugin_loader.get_class('plugin_fixture.FakeTask')
self.assertEqual(loaded_class({}, {}).work(), 'FakeTask')
self.plugin_loader.remove_path(package_path)

def test_load_zip(self):
package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'resources', 'plugin_fixture_test.zip')
self.plugin_loader.load_path(package_path)
self.plugin_loader.load_plugin(package_path)
loaded_class = self.plugin_loader.get_class('plugin_fixture_test.FakeTask')
self.assertEqual(loaded_class({}, {}).work(), 'FakeTask')
self.plugin_loader.remove_path(package_path)
4 changes: 2 additions & 2 deletions tests/tree_config_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_task_with_config(self):
def test_load_plugin_task(self):
package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'resources', 'plugin_fixture')
plugin_loader = PluginLoader()
plugin_loader.load_path(package_path)
plugin_loader.load_plugin(package_path)

obj = convert_from_json("""[{
"type": "plugin_fixture.FakeTask"
Expand All @@ -103,7 +103,7 @@ def test_load_plugin_task(self):
def setupUnsupportedBuilder(self):
package_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'pokemongo_bot', 'test', 'resources', 'plugin_fixture')
plugin_loader = PluginLoader()
plugin_loader.load_path(package_path)
plugin_loader.load_plugin(package_path)

obj = convert_from_json("""[{
"type": "plugin_fixture.UnsupportedApiTask"
Expand Down

0 comments on commit dee28d9

Please sign in to comment.