def testPluginStopStart(self): logger.debug('-'*26 + '\n') logger.info('Running simple plugin restart test...') import onionrplugins try: onionrplugins.start('test') onionrplugins.stop('test') self.assertTrue(True) except: self.assertTrue(False)
def reload_plugin(o_inst): ''' Reloads (stops and starts) all plugins, or the given plugin ''' if len(sys.argv) >= 3: plugin_name = sys.argv[2] logger.info('Reloading plugin "%s"...' % plugin_name) plugins.stop(plugin_name, o_inst) plugins.start(plugin_name, o_inst) else: logger.info('Reloading all plugins...') plugins.reload(o_inst)
def reloadPlugin(self): ''' Reloads (stops and starts) all plugins, or the given plugin ''' if len(sys.argv) >= 3: plugin_name = sys.argv[2] logger.info('Reloading plugin \"' + plugin_name + '\"...') plugins.stop(plugin_name) plugins.start(plugin_name) else: logger.info('Reloading all plugins...') plugins.reload() return
def testPluginStopStart(self): logger.debug('-' * 26 + '\n') logger.info('Running simple plugin restart test...') import onionrplugins, os if not onionrplugins.exists('test'): os.makedirs(onionrplugins.get_plugins_folder('test')) with open( onionrplugins.get_plugins_folder('test') + '/main.py', 'a') as main: main.write( "print('Running')\n\ndef on_test(pluginapi, data = None):\n print('received test event!')\n return True\n\ndef on_start(pluginapi, data = None):\n print('start event called')\n\ndef on_stop(pluginapi, data = None):\n print('stop event called')\n\ndef on_enable(pluginapi, data = None):\n print('enable event called')\n\ndef on_disable(pluginapi, data = None):\n print('disable event called')\n" ) onionrplugins.enable('test') try: onionrplugins.start('test') onionrplugins.stop('test') self.assertTrue(True) except: self.assertTrue(False)
def stop(self, name): onionrplugins.stop(name)