/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-26 18:53:33 UTC
  • mfrom: (2465 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2466.
  • Revision ID: john@arbash-meinel.com-20070426185333-i1xlyaeyf049kdxc
[merge] bzr.dev 2465

Show diffs side-by-side

added added

removed removed

Lines of Context:
253
253
    def test_get_topics_launchpad(self):
254
254
        """Searching for 'launchpad' returns the launchpad plugin docstring."""
255
255
        index = plugin.PluginsHelpIndex()
256
 
        # if bzr was run with '--no-plugins' we need to manually load the
257
 
        # reference plugin. Its shipped with bzr, and loading at this point
258
 
        # won't add additional tests to run.
259
 
        import bzrlib.plugins.launchpad
260
 
        topics = index.get_topics('launchpad')
261
 
        self.assertEqual(1, len(topics))
262
 
        self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
263
 
        self.assertEqual(bzrlib.plugins.launchpad, topics[0].module)
 
256
        self.assertFalse(sys.modules.has_key('bzrlib.plugins.get_topics'))
 
257
        demo_module = FakeModule('', 'bzrlib.plugins.get_topics')
 
258
        sys.modules['bzrlib.plugins.get_topics'] = demo_module
 
259
        try:
 
260
            topics = index.get_topics('get_topics')
 
261
            self.assertEqual(1, len(topics))
 
262
            self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
 
263
            self.assertEqual(demo_module, topics[0].module)
 
264
        finally:
 
265
            del sys.modules['bzrlib.plugins.get_topics']
264
266
 
265
267
    def test_get_topics_no_topic(self):
266
268
        """Searching for something that is not a plugin returns []."""
277
279
    def test_get_topic_with_prefix(self):
278
280
        """Searching for plugins/launchpad returns launchpad module help."""
279
281
        index = plugin.PluginsHelpIndex()
280
 
        # if bzr was run with '--no-plugins' we need to manually load the
281
 
        # reference plugin. Its shipped with bzr, and loading at this point
282
 
        # won't add additional tests to run.
283
 
        import bzrlib.plugins.launchpad
284
 
        topics = index.get_topics('plugins/launchpad')
285
 
        self.assertEqual(1, len(topics))
286
 
        self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
287
 
        self.assertEqual(bzrlib.plugins.launchpad, topics[0].module)
 
282
        self.assertFalse(sys.modules.has_key('bzrlib.plugins.get_topics'))
 
283
        demo_module = FakeModule('', 'bzrlib.plugins.get_topics')
 
284
        sys.modules['bzrlib.plugins.get_topics'] = demo_module
 
285
        try:
 
286
            topics = index.get_topics('plugins/get_topics')
 
287
            self.assertEqual(1, len(topics))
 
288
            self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
 
289
            self.assertEqual(demo_module, topics[0].module)
 
290
        finally:
 
291
            del sys.modules['bzrlib.plugins.get_topics']
288
292
 
289
293
 
290
294
class FakeModule(object):