Esempio n. 1
0
    def test_loader(self):
        """
        The old_PFakeInterface thing ensures that genesis2.apis is registered with the correct plugin.
        That's because genesis2.core.tests.plugins are already loaded but in teardown i deleted the genesis2.apis
        entries to reset the side effects of the other tests, so sys.modules has the genesis2.core.tests.plugins loaded
        and it's impossible to rerun the bunch of __init__.py that would trigger the storing of the plugins in the apis
        (reload doesn't do that by design).
        """
        pluginloader = PluginLoader()
        pluginloader.load_plugins('genesis2/core/tests')
        # Reset the registered plugins
        if hasattr(TestPluginManager, 'old_PFakeInterface'):
            genesis2.apis.PFakeInterface = TestPluginManager.old_PFakeInterface
        if hasattr(TestPluginManager, 'old_PAnotherInterface'):
            genesis2.apis.PAnotherInterface = TestPluginManager.old_PAnotherInterface

        self.assertTrue(hasattr(genesis2.apis, "PFakeInterface"))
        ret = genesis2.apis.PFakeInterface.non_required()
        self.assertEqual(ret, "f*****g awesome")
Esempio n. 2
0
 def setUp(self):
     plugin_loader = PluginLoader()
     plugin_loader.load_plugins('genesis2/core/tests')
     self.appmgr = AppManager("/".join((__file__.split("/")[:-1])) + "/apps")
     self.appmgr.path_apps = "/".join((__file__.split("/")[:-1])) + "/apps"
     self.appmgr.load_apps()