~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

Fixed as per review comments.

* bzrlib/tests/test_plugins.py:
(TestDisablePlugin.test_not_loaded,
TestDisablePlugin.test_cannot_import): Update tests.

* bzrlib/tests/__init__.py:
(TestCase._cleanEnvironment): Add BZR_DISABLE_PLUGINS.

* bzrlib/plugin.py:
(set_plugins_path): Use a dedicated BZR_DISABLE_PLUGINS env var
instead of mucking with BZR_PLUGIN_PATH.

Show diffs side-by-side

added added

removed removed

Lines of Context:
755
755
        self.addCleanup(self._unregister_plugin, 'test_foo')
756
756
 
757
757
    def test_cannot_import(self):
758
 
        plugin.set_plugins_path(['.', '-test_foo'])
 
758
        osutils.set_or_unset_env('BZR_DISABLE_PLUGINS', 'test_foo')
 
759
        plugin.set_plugins_path(['.'])
759
760
        try:
760
761
            import bzrlib.plugins.test_foo
761
762
        except ImportError:
773
774
            self.warnings.append((args, kwargs))
774
775
        self.overrideAttr(trace, 'warning', captured_warning)
775
776
        self.overrideAttr(plugin, '_loaded', False)
776
 
        plugin.load_plugins(plugin.set_plugins_path(['.', '-test_foo']))
 
777
        osutils.set_or_unset_env('BZR_DISABLE_PLUGINS', 'test_foo')
 
778
        plugin.load_plugins(plugin.set_plugins_path(['.']))
777
779
        self.assertPluginUnknown('test_foo')
778
780
        # Make sure we don't warn about the plugin ImportError since this has
779
781
        # been *requested* by the user.