~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Vincent Ladeuil
  • Date: 2012-03-13 17:25:29 UTC
  • mfrom: (6499 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6501.
  • Revision ID: v.ladeuil+lp@free.fr-20120313172529-i0suyjnepsor25i7
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
        # check the plugin is not loaded already
310
310
        self.assertPluginUnknown('plugin')
311
311
        # write a plugin that _cannot_ fail to load.
312
 
        file('plugin.py', 'w').write(source + '\n')
 
312
        with file('plugin.py', 'w') as f: f.write(source + '\n')
313
313
        self.addCleanup(self.teardown_plugin)
314
314
        plugin.load_from_path(['.'])
315
315
 
615
615
    def test_get_help_text_with_additional_see_also(self):
616
616
        mod = FakeModule('two lines of help\nand more', 'demo')
617
617
        topic = plugin.ModuleHelpTopic(mod)
618
 
        self.assertEqual("two lines of help\nand more\nSee also: bar, foo\n",
619
 
            topic.get_help_text(['foo', 'bar']))
 
618
        self.assertEqual("two lines of help\nand more\n\n:See also: bar, foo\n",
 
619
                         topic.get_help_text(['foo', 'bar']))
620
620
 
621
621
    def test_get_help_topic(self):
622
622
        """The help topic for a plugin is its module name."""
623
623
        mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.demo')
624
624
        topic = plugin.ModuleHelpTopic(mod)
625
625
        self.assertEqual('demo', topic.get_help_topic())
626
 
        mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.foo_bar')
 
626
        mod = FakeModule('two lines of help\nand more',
 
627
                         'bzrlib.plugins.foo_bar')
627
628
        topic = plugin.ModuleHelpTopic(mod)
628
629
        self.assertEqual('foo_bar', topic.get_help_topic())
629
630