~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_controldir.py

  • Committer: Andrew Starr-Bochicchio
  • Date: 2014-03-30 17:59:29 UTC
  • mto: This revision was merged to the branch mainline in revision 6592.
  • Revision ID: a.starr.b@gmail.com-20140330175929-rd97jstcbau2j1gy
Use LooseVersion from distutils to check Cython version in order to handle non-integers in the version string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2011, 2016 Canonical Ltd
 
1
# Copyright (C) 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
50
50
    def test_register_unregister_format(self):
51
51
        format = SampleComponentFormat()
52
52
        self.registry.register(format)
53
 
        self.assertEqual(format,
 
53
        self.assertEquals(format,
54
54
            self.registry.get("Example component format."))
55
55
        self.registry.remove(format)
56
56
        self.assertRaises(KeyError, self.registry.get,
58
58
 
59
59
    def test_get_all(self):
60
60
        format = SampleComponentFormat()
61
 
        self.assertEqual([], self.registry._get_all())
 
61
        self.assertEquals([], self.registry._get_all())
62
62
        self.registry.register(format)
63
 
        self.assertEqual([format], self.registry._get_all())
 
63
        self.assertEquals([format], self.registry._get_all())
64
64
 
65
65
    def test_get_all_modules(self):
66
66
        format = SampleComponentFormat()
67
 
        self.assertEqual(set(), self.registry._get_all_modules())
 
67
        self.assertEquals(set(), self.registry._get_all_modules())
68
68
        self.registry.register(format)
69
 
        self.assertEqual(
 
69
        self.assertEquals(
70
70
            set(["bzrlib.tests.test_controldir"]),
71
71
            self.registry._get_all_modules())
72
72
 
73
73
    def test_register_extra(self):
74
74
        format = SampleExtraComponentFormat()
75
 
        self.assertEqual([], self.registry._get_all())
 
75
        self.assertEquals([], self.registry._get_all())
76
76
        self.registry.register_extra(format)
77
 
        self.assertEqual([format], self.registry._get_all())
 
77
        self.assertEquals([format], self.registry._get_all())
78
78
 
79
79
    def test_register_extra_lazy(self):
80
 
        self.assertEqual([], self.registry._get_all())
 
80
        self.assertEquals([], self.registry._get_all())
81
81
        self.registry.register_extra_lazy("bzrlib.tests.test_controldir",
82
82
            "SampleExtraComponentFormat")
83
83
        formats = self.registry._get_all()
84
 
        self.assertEqual(1, len(formats))
 
84
        self.assertEquals(1, len(formats))
85
85
        self.assertIsInstance(formats[0], SampleExtraComponentFormat)
86
86
 
87
87
 
219
219
        format = controldir.ControlComponentFormat()
220
220
        format.check_support_status(allow_unsupported=False,
221
221
            recommend_upgrade=True)
222
 
        self.assertEqual("", stderr.getvalue())
 
222
        self.assertEquals("", stderr.getvalue())
223
223
 
224
224
    def test_recommend_upgrade_old_format(self):
225
225
        stderr = tests.StringIOWrapper()
227
227
        format = OldControlComponentFormat()
228
228
        format.check_support_status(allow_unsupported=False,
229
229
            recommend_upgrade=False)
230
 
        self.assertEqual("", stderr.getvalue())
 
230
        self.assertEquals("", stderr.getvalue())
231
231
        format.check_support_status(allow_unsupported=False,
232
232
            recommend_upgrade=True, basedir='apath')
233
 
        self.assertEqual(
 
233
        self.assertEquals(
234
234
            'An old format that is slow is deprecated and a better format '
235
235
            'is available.\nIt is recommended that you upgrade by running '
236
236
            'the command\n  bzr upgrade apath\n',