Rev 2455: Avoid plugin tests failing when run with --no-plugins in http://sourcefrog.net/bzr/plugin-help
John Arbash Meinel
john at arbash-meinel.com
Wed Apr 25 14:33:08 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> At http://sourcefrog.net/bzr/plugin-help
>
> ------------------------------------------------------------
> revno: 2455
> revision-id: mbp at sourcefrog.net-20070425063340-68rbj3dtcar1s9y1
> parent: pqm at pqm.ubuntu.com-20070425054241-urh0t3nequwc2j6q
> committer: Martin Pool <mbp at sourcefrog.net>
> branch nick: plugin-help
> timestamp: Wed 2007-04-25 16:33:40 +1000
> message:
> Avoid plugin tests failing when run with --no-plugins
> modified:
> bzrlib/plugin.py plugin.py-20050622060424-829b654519533d69
> bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
> === modified file 'bzrlib/plugin.py'
> --- a/bzrlib/plugin.py 2007-04-20 05:44:37 +0000
> +++ b/bzrlib/plugin.py 2007-04-25 06:33:40 +0000
> @@ -48,8 +48,8 @@
>
> from bzrlib.trace import mutter, warning, log_exception_quietly
>
> -
> DEFAULT_PLUGIN_PATH = None
> +_plugins_disabled = False
> _loaded = False
>
> def get_default_plugin_path():
> @@ -76,8 +76,9 @@
> """
> # TODO: jam 20060131 This should probably also disable
> # load_from_dirs()
> - global _loaded
> + global _loaded, _plugins_disabled
> _loaded = True
> + _plugins_disabled = True
>
>
> def set_plugins_path():
>
> === modified file 'bzrlib/tests/test_plugins.py'
> --- a/bzrlib/tests/test_plugins.py 2007-04-20 05:44:37 +0000
> +++ b/bzrlib/tests/test_plugins.py 2007-04-25 06:33:40 +0000
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2005 Canonical Ltd
> +# Copyright (C) 2005, 2007 Canonical Ltd
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -30,7 +30,7 @@
> import bzrlib.plugins
> import bzrlib.commands
> import bzrlib.help
> -from bzrlib.tests import TestCase, TestCaseInTempDir
> +from bzrlib.tests import TestCase, TestCaseInTempDir, TestSkipped
> from bzrlib.osutils import pathjoin, abspath
>
>
> @@ -242,6 +242,11 @@
> class TestHelpIndex(tests.TestCase):
> """Tests for the PluginsHelpIndex class."""
>
> + def _needs_plugins(self):
> + if plugin._plugins_disabled:
> + raise TestSkipped("tests are run with --no-plugins; "
> + "can't examine launchpad plugin")
> +
This would be a really good case for a "PluginsLoadedFeature", since
that gives you a nice "tests skipped because plugins aren't loaded".
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGL1iTJdeBCYSNAAMRAg4JAKC9FbH1Cngk/3OcnN6Wyq+lk43zYQCeOWji
/EDQZ2HVysOJmnxhV/CvfaA=
=DQ1K
-----END PGP SIGNATURE-----
More information about the bazaar-commits
mailing list