~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-18 13:02:52 UTC
  • mfrom: (5830.3.6 i18n-msgfmt)
  • Revision ID: pqm@pqm.ubuntu.com-20110518130252-ky96qcvzt6o0zg3f
(mbp) add build_mo command to setup.py (INADA Naoki)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
284
284
        log = self.load_and_capture(name)
285
285
        self.assertNotContainsRe(log,
286
286
            r"It requested API version")
287
 
        self.assertEqual(
 
287
        self.assertEquals(
288
288
            ['wants100'],
289
289
            plugin.plugin_warnings.keys())
290
290
        self.assertContainsRe(
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
 
        with file('plugin.py', 'w') as f: f.write(source + '\n')
 
312
        file('plugin.py', 'w').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\n\n:See also: bar, foo\n",
619
 
                         topic.get_help_text(['foo', 'bar']))
 
618
        self.assertEqual("two lines of help\nand more\nSee 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',
627
 
                         'bzrlib.plugins.foo_bar')
 
626
        mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.foo_bar')
628
627
        topic = plugin.ModuleHelpTopic(mod)
629
628
        self.assertEqual('foo_bar', topic.get_help_topic())
630
629
 
709
708
        if setting_dirs:
710
709
            self._set_path(*setting_dirs)
711
710
        actual = plugin.get_standard_plugins_path()
712
 
        self.assertEqual(self._list2paths(*expected_dirs), actual)
 
711
        self.assertEquals(self._list2paths(*expected_dirs), actual)
713
712
 
714
713
    def test_default(self):
715
714
        self.check_path([self.user, self.core, self.site],
827
826
        return plugin._get_specific_plugin_paths(paths)
828
827
 
829
828
    def test_empty(self):
830
 
        self.assertEqual([], self._get_paths(None))
831
 
        self.assertEqual([], self._get_paths(''))
 
829
        self.assertEquals([], self._get_paths(None))
 
830
        self.assertEquals([], self._get_paths(''))
832
831
 
833
832
    def test_one_path(self):
834
 
        self.assertEqual([('b', 'man')], self._get_paths('b@man'))
 
833
        self.assertEquals([('b', 'man')], self._get_paths('b@man'))
835
834
 
836
835
    def test_bogus_path(self):
837
836
        # We need a '@'
975
974
        self.overrideAttr(plugin, 'plugin_warnings',
976
975
            {'bad': ['Failed to load (just testing)']})
977
976
        self.overrideAttr(plugin, 'plugins', dummy_plugins)
978
 
        self.assertEqual("""\
 
977
        self.assertEquals("""\
979
978
bad (failed to load)
980
979
  ** Failed to load (just testing)
981
980