def test_doInstanceConvertPlugins(self): loaded_plugins_classes = pluginLoad(self.plugins_dir, self.plugin_subclass_convert) loaded_plugins_instances = [] for plc in loaded_plugins_classes: plugin_instance = plc() loaded_plugins_instances.append(plugin_instance) self.assertNotEqual(len(loaded_plugins_instances), 0, "No Plugin Instance")
def setUp(self): PluginLoadTest.setUp(self) # load and do instances of plugns plugins = pluginLoad(self.plugins_dir, ConvertBase) self.plugins = plugin_instance(plugins) # subtitles files self.test_files_dir = os.getcwd() + '/test_files/' self.sub_mdvd = self.test_files_dir + 'mdvd.txt' self.sub_mpl2 = self.test_files_dir + 'mpl2.txt' self.sub_srt = self.test_files_dir + 'srt.srt' self.sub_tmpl = self.test_files_dir + 'tmpl.txt' self.not_sub = self.test_files_dir + 'notsub.txt'
def test_loadConvertPlugins(self): loaded_plugins = pluginLoad(self.plugins_dir, self.plugin_subclass_convert) self.assertNotEqual(len(loaded_plugins), 0, "Plugins not Loaded")
def test_LoadPlugins_dir5(self): "Dir without plugins" loaded_plugins = pluginLoad(self.plugindir1, self.plugin_baseclass) self.assertEqual(len(loaded_plugins), 0, "Some plugin has been loaded")
def test_LoadPlugins_dir0(self): "Dir with plugins" loaded_plugins = pluginLoad(self.plugindir0, self.plugin_baseclass) self.assertEqual(len(loaded_plugins), 2, "Plugins count different from expected") self.assertNotEqual(len(loaded_plugins), 0, "No plugin has been loaded")
# Copyright 2012 Daniel Dereziński <*****@*****.**> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA from gkcore.convert import ConvertBase from gkcore.subsdwn import SubsDownloadBase from gkcore.core import pluginLoad, plugin_instance import os PLUGIN_DIR = [os.path.dirname(__file__)] #katalog bazowy dla pluginów PLUGINS_CONVERT = None PLUGINS_SUBS_DOWN = None _plugins_convert = pluginLoad(PLUGIN_DIR, ConvertBase) PLUGINS_CONVERT = plugin_instance(_plugins_convert) _plugins_subs_down = pluginLoad(PLUGIN_DIR, SubsDownloadBase) PLUGINS_SUBS_DOWN = plugin_instance(_plugins_subs_down)