~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-07 00:28:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4842.
  • Revision ID: john@arbash-meinel.com-20091107002826-umvwb3zl0yajo6rc
Use StaticTuple as part of the builder process.

Also use it in the pure python btree parser, mostly for consistency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
575
575
 
576
576
    def setUp(self):
577
577
        super(TestLoadFromPath, self).setUp()
 
578
        # Save the attributes that we're about to monkey-patch.
 
579
        old_plugins_path = bzrlib.plugins.__path__
 
580
        old_loaded = plugin._loaded
 
581
        old_load_from_path = plugin.load_from_path
 
582
 
 
583
        def restore():
 
584
            bzrlib.plugins.__path__ = old_plugins_path
 
585
            plugin._loaded = old_loaded
 
586
            plugin.load_from_path = old_load_from_path
 
587
 
 
588
        self.addCleanup(restore)
 
589
 
578
590
        # Change bzrlib.plugin to think no plugins have been loaded yet.
579
 
        self.overrideAttr(bzrlib.plugins, '__path__', [])
580
 
        self.overrideAttr(plugin, '_loaded', False)
 
591
        bzrlib.plugins.__path__ = []
 
592
        plugin._loaded = False
581
593
 
582
594
        # Monkey-patch load_from_path to stop it from actually loading anything.
583
 
        self.overrideAttr(plugin, 'load_from_path', lambda dirs: None)
 
595
        def load_from_path(dirs):
 
596
            pass
 
597
        plugin.load_from_path = load_from_path
584
598
 
585
599
    def test_set_plugins_path_with_args(self):
586
600
        plugin.set_plugins_path(['a', 'b'])
631
645
 
632
646
    def setUp(self):
633
647
        super(TestEnvPluginPath, self).setUp()
634
 
        self.overrideAttr(plugin, 'DEFAULT_PLUGIN_PATH', None)
 
648
        old_default = plugin.DEFAULT_PLUGIN_PATH
 
649
 
 
650
        def restore():
 
651
            plugin.DEFAULT_PLUGIN_PATH = old_default
 
652
 
 
653
        self.addCleanup(restore)
 
654
 
 
655
        plugin.DEFAULT_PLUGIN_PATH = None
635
656
 
636
657
        self.user = plugin.get_user_plugin_path()
637
658
        self.site = plugin.get_site_plugin_path()