Example #1
0
    def test_should_load_hello_world(self):
        # Given
        hello_world = join(HERE, 'data', 'hello_world.py')

        # When
        plugin = load_file(hello_world)

        # Then
        self.assertEqual('hello world', plugin.main())

        return
Example #2
0
    def _load_plugin_from_path(self, path):
        """ Load the plugin at the given path. """

        plugin = load_file(path)

        if getattr(plugin, 'main', None) is not None:
            self._add_command_from_plugin(plugin)

        if getattr(plugin, 'idle_hook', None) is not None:
            self._idle_hooks.append(plugin.idle_hook)

        if getattr(plugin, 'message_processor', None) is not None:
            self._message_processors.append(plugin.message_processor)

        return