All pastes #978402 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-09 15:10 UTC
rendered paste body
    def test_hot_upgrade(self):
        """
        Load a component from a plugin, then upgrade the plugin and check that
        the component is reloaded.
        """
        from elisa.plugins.test_simple.test_module import TestComponent
        from elisa.plugins.test_simple import test_module

        self.failUnlessEqual(test_module.version, '0.1')

        def upgrade_plugin(component):
            res = component.do_something()
            self.failUnlessEqual(res, 'done in 0.1')

            self.install_plugin('test_simple-0.2', '0.2/test_simple')
            self.plugin_registry.load_plugins()

            self.failUnlessEqual(test_module.version, '0.2')
            res = component.do_something()
            self.failUnlessEqual(res, 'done in 0.2')

            return component.clean()

        d = TestComponent.create()
        d.addCallback(upgrade_plugin)

        return d