Rev 2437: Initial stub for topic searching. in file:///home/robertc/source/baz/help-contexts/
Robert Collins
robertc at robertcollins.net
Fri Apr 20 01:18:32 BST 2007
At file:///home/robertc/source/baz/help-contexts/
------------------------------------------------------------
revno: 2437
revision-id: robertc at robertcollins.net-20070420001830-lrxkvu3fkd1d7bnn
parent: robertc at robertcollins.net-20070420001415-iequi10ao2s4jtu4
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 10:18:30 +1000
message:
Initial stub for topic searching.
modified:
bzrlib/help.py help.py-20050505025907-4dd7a6d63912f894
bzrlib/tests/test_help.py test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/help.py'
--- a/bzrlib/help.py 2007-04-20 00:06:46 +0000
+++ b/bzrlib/help.py 2007-04-20 00:18:30 +0000
@@ -26,6 +26,7 @@
from bzrlib import (
commands as _mod_commands,
+ errors,
help_topics,
osutils,
)
@@ -189,3 +190,11 @@
help_topics.HelpTopicContext(),
_mod_commands.HelpCommandContext(),
]
+
+ def search(self, topic):
+ """Search for topic across the help search path.
+
+ :param topic: A string naming the help topic to search for.
+ :raises: NoHelpTopic if none of the contexts in search_path have topic.
+ """
+ raise errors.NoHelpTopic(topic)
=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py 2007-04-20 00:06:46 +0000
+++ b/bzrlib/tests/test_help.py 2007-04-20 00:18:30 +0000
@@ -20,6 +20,7 @@
from bzrlib import (
commands,
+ errors,
help,
help_topics,
tests,
@@ -70,3 +71,10 @@
# with commands being search second.
self.assertIsInstance(contexts.search_path[1],
commands.HelpCommandContext)
+
+ def test_search_for_unknown_topic_raises(self):
+ """Searching for an unknown topic should raise NoHelpTopic."""
+ contexts = help.HelpContexts()
+ contexts.search_path = []
+ error = self.assertRaises(errors.NoHelpTopic, contexts.search, 'foo')
+ self.assertEqual('foo', error.topic)
More information about the bazaar-commits
mailing list