Rev 2461: Add get_help_topic to ModuleHelpTopic. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 06:41:59 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2461
revision-id: robertc at robertcollins.net-20070420054157-mq24v4iv28awko06
parent: robertc at robertcollins.net-20070420053919-edekarog2f6qvyzx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 15:41:57 +1000
message:
  Add get_help_topic to ModuleHelpTopic.
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:30:47 +0000
+++ b/bzrlib/plugin.py	2007-04-20 05:41:57 +0000
@@ -331,3 +331,7 @@
             result += ', '.join(see_also)
             result += '\n'
         return result
+
+    def get_help_topic(self):
+        """Return the modules help topic - its __name__."""
+        return self.module.__name__

=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py	2007-04-20 05:30:47 +0000
+++ b/bzrlib/tests/test_plugins.py	2007-04-20 05:41:57 +0000
@@ -330,3 +330,12 @@
         topic = plugin.ModuleHelpTopic(mod)
         self.assertEqual("two lines of help\nand more\nSee also: bar, foo\n",
             topic.get_help_text(['foo', 'bar']))
+
+    def test_get_help_topic(self):
+        """The help topic for a plugin is its module name."""
+        mod = FakeModule('two lines of help\nand more', 'demo')
+        topic = plugin.ModuleHelpTopic(mod)
+        self.assertEqual('demo', topic.get_help_topic())
+        mod = FakeModule('two lines of help\nand more', 'foo_bar')
+        topic = plugin.ModuleHelpTopic(mod)
+        self.assertEqual('foo_bar', topic.get_help_topic())



More information about the bazaar-commits mailing list