Rev 2462: Fix the ModuleHelpTopic get_help_topic to be tested with closer to real world data and strip the bzrlib.plugins. prefix from the name. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 06:44:40 BST 2007


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

------------------------------------------------------------
revno: 2462
revision-id: robertc at robertcollins.net-20070420054437-5txpyqld8y7cl3k5
parent: robertc at robertcollins.net-20070420054157-mq24v4iv28awko06
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 15:44:37 +1000
message:
  Fix the ModuleHelpTopic get_help_topic to be tested with closer to real world data and strip the bzrlib.plugins. prefix from the name.
modified:
  bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
  bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
  bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
=== modified file 'bzrlib/help.py'
--- a/bzrlib/help.py	2007-04-20 04:36:09 +0000
+++ b/bzrlib/help.py	2007-04-20 05:44:37 +0000
@@ -42,7 +42,7 @@
     topics = indices.search(topic)
     shadowed_terms = []
     for index, topic in topics[1:]:
-        shadowed_terms.append('%s%s' % (index.prefix, topic))
+        shadowed_terms.append('%s%s' % (index.prefix, topic.get_help_topic()))
     outfile.write(topics[0][1].get_help_text(shadowed_terms))
 
 

=== modified file 'bzrlib/plugin.py'
--- a/bzrlib/plugin.py	2007-04-20 05:41:57 +0000
+++ b/bzrlib/plugin.py	2007-04-20 05:44:37 +0000
@@ -333,5 +333,5 @@
         return result
 
     def get_help_topic(self):
-        """Return the modules help topic - its __name__."""
-        return self.module.__name__
+        """Return the modules help topic - its __name__ after bzrlib.plugins.."""
+        return self.module.__name__[len('bzrlib.plugins.'):]

=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py	2007-04-20 05:41:57 +0000
+++ b/bzrlib/tests/test_plugins.py	2007-04-20 05:44:37 +0000
@@ -333,9 +333,9 @@
 
     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')
+        mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.demo')
         topic = plugin.ModuleHelpTopic(mod)
         self.assertEqual('demo', topic.get_help_topic())
-        mod = FakeModule('two lines of help\nand more', 'foo_bar')
+        mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.foo_bar')
         topic = plugin.ModuleHelpTopic(mod)
         self.assertEqual('foo_bar', topic.get_help_topic())



More information about the bazaar-commits mailing list