本文整理汇总了Python中yapsy.PluginManager.PluginManager.setPluginLocator方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.setPluginLocator方法的具体用法?Python PluginManager.setPluginLocator怎么用?Python PluginManager.setPluginLocator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yapsy.PluginManager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.setPluginLocator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setPluginLocator_with_plugin_info_class
# 需要导入模块: from yapsy.PluginManager import PluginManager [as 别名]
# 或者: from yapsy.PluginManager.PluginManager import setPluginLocator [as 别名]
def test_setPluginLocator_with_plugin_info_class(self):
class SpecificLocator(IPluginLocator):
def getPluginInfoClass(self):
return self.picls
def setPluginInfoClass(self,picls):
self.picls = picls
class SpecificPluginInfo(PluginInfo):
pass
pm = PluginManager()
pm.setPluginLocator(SpecificLocator(),picls=SpecificPluginInfo)
self.assertEqual(SpecificPluginInfo,pm.getPluginInfoClass())
示例2: testNonRecursivePluginlocationNotFound
# 需要导入模块: from yapsy.PluginManager import PluginManager [as 别名]
# 或者: from yapsy.PluginManager.PluginManager import setPluginLocator [as 别名]
def testNonRecursivePluginlocationNotFound(self):
"""
Test detection of plugins when the detection is non recursive.
Here we test that it cannot look into subdirectories of the
test directory.
"""
pluginLocator = PluginFileLocator()
pluginLocator.setPluginPlaces([
os.path.dirname(os.path.abspath(__file__))])
pluginLocator.disableRecursiveScan()
spm = PluginManager()
spm.setPluginLocator(pluginLocator)
# load the plugins that may be found
spm.collectPlugins()
# check that the getCategories works
self.assertEqual(len(spm.getCategories()),1)
sole_category = spm.getCategories()[0]
# check the getPluginsOfCategory
self.assertEqual(len(spm.getPluginsOfCategory(sole_category)),0)
示例3: testDisablingRecursivePluginLocationAllowsFindingTopLevelPlugins
# 需要导入模块: from yapsy.PluginManager import PluginManager [as 别名]
# 或者: from yapsy.PluginManager.PluginManager import setPluginLocator [as 别名]
def testDisablingRecursivePluginLocationAllowsFindingTopLevelPlugins(self):
"""
Test detection of plugins when the detection is non
recursive. Here we test that if we give test/plugin as the
directory to scan it can find the plugin.
"""
pluginLocator = PluginFileLocator()
pluginLocator.setPluginPlaces([
os.path.join(
os.path.dirname(os.path.abspath(__file__)),"plugins")])
pluginLocator.disableRecursiveScan()
spm = PluginManager()
spm.setPluginLocator(pluginLocator)
# load the plugins that may be found
spm.collectPlugins()
# check that the getCategories works
self.assertEqual(len(spm.getCategories()),1)
sole_category = spm.getCategories()[0]
# check the getPluginsOfCategory
self.assertEqual(len(spm.getPluginsOfCategory(sole_category)),1)