~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2016 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.assertEquals(
 
287
        self.assertEqual(
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
 
        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
 
708
709
        if setting_dirs:
709
710
            self._set_path(*setting_dirs)
710
711
        actual = plugin.get_standard_plugins_path()
711
 
        self.assertEquals(self._list2paths(*expected_dirs), actual)
 
712
        self.assertEqual(self._list2paths(*expected_dirs), actual)
712
713
 
713
714
    def test_default(self):
714
715
        self.check_path([self.user, self.core, self.site],
826
827
        return plugin._get_specific_plugin_paths(paths)
827
828
 
828
829
    def test_empty(self):
829
 
        self.assertEquals([], self._get_paths(None))
830
 
        self.assertEquals([], self._get_paths(''))
 
830
        self.assertEqual([], self._get_paths(None))
 
831
        self.assertEqual([], self._get_paths(''))
831
832
 
832
833
    def test_one_path(self):
833
 
        self.assertEquals([('b', 'man')], self._get_paths('b@man'))
 
834
        self.assertEqual([('b', 'man')], self._get_paths('b@man'))
834
835
 
835
836
    def test_bogus_path(self):
836
837
        # We need a '@'
974
975
        self.overrideAttr(plugin, 'plugin_warnings',
975
976
            {'bad': ['Failed to load (just testing)']})
976
977
        self.overrideAttr(plugin, 'plugins', dummy_plugins)
977
 
        self.assertEquals("""\
 
978
        self.assertEqual("""\
978
979
bad (failed to load)
979
980
  ** Failed to load (just testing)
980
981