/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 17:48:22 UTC
  • mto: (4987.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125174822-nce4l19sbwx83jvq
Deploying the new overrideAttr facility further reduces the complexity
and make the code clearer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
576
576
    def setUp(self):
577
577
        super(TestLoadFromPath, self).setUp()
578
578
        # Change bzrlib.plugin to think no plugins have been loaded yet.
579
 
        self.addAttrCleanup(bzrlib.plugins, '__path__')
580
 
        bzrlib.plugins.__path__ = []
581
 
        self.addAttrCleanup(plugin, '_loaded')
582
 
        plugin._loaded = False
 
579
        self.overrideAttr(bzrlib.plugins, '__path__', [])
 
580
        self.overrideAttr(plugin, '_loaded', False)
583
581
 
584
 
        self.addAttrCleanup(plugin, 'load_from_path')
585
582
        # Monkey-patch load_from_path to stop it from actually loading anything.
586
 
        def load_from_path(dirs):
587
 
            pass
588
 
        plugin.load_from_path = load_from_path
 
583
        self.overrideAttr(plugin, 'load_from_path', lambda dirs: None)
589
584
 
590
585
    def test_set_plugins_path_with_args(self):
591
586
        plugin.set_plugins_path(['a', 'b'])
636
631
 
637
632
    def setUp(self):
638
633
        super(TestEnvPluginPath, self).setUp()
639
 
        self.addAttrCleanup(plugin, 'DEFAULT_PLUGIN_PATH')
640
 
        plugin.DEFAULT_PLUGIN_PATH = None
 
634
        self.overrideAttr(plugin, 'DEFAULT_PLUGIN_PATH', None)
641
635
 
642
636
        self.user = plugin.get_user_plugin_path()
643
637
        self.site = plugin.get_site_plugin_path()