def test_load_existing(self, mock_pkg_res): """Ensure that plugin objects are returned if found.""" mock_pkg_res.iter_entry_points.side_effect = mock_iter_entry_points # Load a couple of existing modules and verify that they're Ok plug = mycroft_plugins.load_plugin('mycroft.plugins.tts', 'dummy') self.assertEqual(plug.name, 'dummy') plug = mycroft_plugins.load_plugin('mycroft.plugins.stt', 'deepspeech') self.assertEqual(plug.name, 'deepspeech')
def load_wake_word_plugin(module_name): """Wrapper function for loading wake word plugin. Args: (str) Mycroft wake word module name from config """ return load_plugin('mycroft.plugin.wake_word', module_name)
def load_tts_plugin(module_name): """Wrapper function for loading tts plugin. Args: (str) Mycroft tts module name from config Returns: class: found tts plugin class """ return load_plugin('mycroft.plugin.tts', module_name)
def load_stt_plugin(module_name): """Wrapper function for loading stt plugin. Arguments: module_name (str): Mycroft stt module name from config Returns: class: STT plugin class """ return load_plugin('mycroft.plugin.stt', module_name)
def test_load_nonexisting(self, mock_pkg_res): """Ensure that the return value is None when no plugin is found.""" mock_pkg_res.iter_entry_points.side_effect = mock_iter_entry_points plug = mycroft_plugins.load_plugin('mycroft.plugins.tts', 'blah') self.assertEqual(plug, None)