~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-02-23 14:10:21 UTC
  • mfrom: (3193.7.12 plugins.for.bzr.exe)
  • Revision ID: pqm@pqm.ubuntu.com-20080223141021-zgxlzjmg5c0hym5n
(bialix) bzr.exe: move builtin plugins out of library.zip

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import bzrlib.plugins
32
32
import bzrlib.commands
33
33
import bzrlib.help
34
 
from bzrlib.symbol_versioning import zero_ninetyone
 
34
from bzrlib.symbol_versioning import one_three
35
35
from bzrlib.tests import TestCase, TestCaseInTempDir
36
36
from bzrlib.osutils import pathjoin, abspath, normpath
37
37
 
214
214
        stream.close()
215
215
 
216
216
 
217
 
class TestAllPlugins(TestCaseInTempDir):
218
 
 
219
 
    def test_plugin_appears_in_all_plugins(self):
220
 
        # This test tests a new plugin appears in bzrlib.plugin.all_plugins().
221
 
        # check the plugin is not loaded already
222
 
        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
223
 
        # write a plugin that _cannot_ fail to load.
224
 
        file('plugin.py', 'w').write("\n")
225
 
        try:
226
 
            bzrlib.plugin.load_from_path(['.'])
227
 
            all_plugins = self.applyDeprecated(zero_ninetyone,
228
 
                bzrlib.plugin.all_plugins)
229
 
            self.failUnless('plugin' in all_plugins)
230
 
            self.failUnless(getattr(bzrlib.plugins, 'plugin', None))
231
 
            self.assertEqual(all_plugins['plugin'], bzrlib.plugins.plugin)
232
 
        finally:
233
 
            # remove the plugin 'plugin'
234
 
            if 'bzrlib.plugins.plugin' in sys.modules:
235
 
                del sys.modules['bzrlib.plugins.plugin']
236
 
            if getattr(bzrlib.plugins, 'plugin', None):
237
 
                del bzrlib.plugins.plugin
238
 
        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
239
 
 
240
 
 
241
217
class TestPlugins(TestCaseInTempDir):
242
218
 
243
219
    def setup_plugin(self, source=""):
408
384
        try:
409
385
            # this is normally done by load_plugins -> set_plugins_path
410
386
            bzrlib.plugins.__path__ = [zip_name]
411
 
            bzrlib.plugin.load_from_zip(zip_name)
 
387
            self.applyDeprecated(one_three,
 
388
                bzrlib.plugin.load_from_zip, zip_name)
412
389
            self.assertTrue(plugin_name in dir(bzrlib.plugins),
413
390
                            'Plugin is not loaded')
414
391
        finally: