示例#1
0
 def test_multiple_dirs(self):
     pm = StoqPluginManager(
         [utils.get_plugins_dir(),
          utils.get_plugins2_dir()])
     collected_plugins = pm.list_plugins()
     for name in self.DUMMY_PLUGINS + ['dummy_worker2']:
         self.assertIn(name, collected_plugins)
示例#2
0
    def test_plugin_override(self):
        """
        Verify that if plugin directories have plugins with duplicate names,
        the one in the last specified directory will be used
        """
        pm = StoqPluginManager([utils.get_plugins_dir(), utils.get_plugins2_dir()])
        collected_plugins = pm.list_plugins()
        self.assertIn('dummy_worker', collected_plugins)
        worker = pm.load_plugin('dummy_worker')
        self.assertTrue(worker.PLUGINS2_DUP_MARKER)

        pm = StoqPluginManager([utils.get_plugins2_dir(), utils.get_plugins_dir()])
        self.assertIn('dummy_worker', collected_plugins)
        worker = pm.load_plugin('dummy_worker')
        with self.assertRaises(Exception):
            worker.PLUGINS2_DUP_MARKER