~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-28 15:04:17 UTC
  • mfrom: (2466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2566.
  • Revision ID: john@arbash-meinel.com-20070428150417-trp3pi0pzd411pu4
[merge] bzr.dev 2466

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
 
3
#            and others
3
4
#
4
5
# This program is free software; you can redistribute it and/or modify
5
6
# it under the terms of the GNU General Public License as published by
40
41
        self.assertEqualDiff('File id {a_file_id} already exists in inventory'
41
42
                             ' as foo', str(error))
42
43
 
 
44
    def test_duplicate_help_prefix(self):
 
45
        error = errors.DuplicateHelpPrefix('foo')
 
46
        self.assertEqualDiff('The prefix foo is in the help search path twice.',
 
47
            str(error))
 
48
 
43
49
    def test_inventory_modified(self):
44
50
        error = errors.InventoryModified("a tree to be repred")
45
51
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
91
97
            "smart protocol.",
92
98
            str(error))
93
99
 
 
100
    def test_no_help_topic(self):
 
101
        error = errors.NoHelpTopic("topic")
 
102
        self.assertEqualDiff("No help could be found for 'topic'. "
 
103
            "Please use 'bzr help topics' to obtain a list of topics.",
 
104
            str(error))
 
105
 
94
106
    def test_no_such_id(self):
95
107
        error = errors.NoSuchId("atree", "anid")
96
108
        self.assertEqualDiff("The file id anid is not present in the tree "
119
131
        error = errors.TooManyConcurrentRequests("a medium")
120
132
        self.assertEqualDiff("The medium 'a medium' has reached its concurrent "
121
133
            "request limit. Be sure to finish_writing and finish_reading on "
122
 
            "the current request that is open.",
 
134
            "the currently open request.",
123
135
            str(error))
124
136
 
125
137
    def test_unknown_hook(self):
233
245
            host='ahost', port=444, msg='Unable to connect to ssh host',
234
246
            orig_error='my_error')
235
247
 
 
248
    def test_malformed_bug_identifier(self):
 
249
        """Test the formatting of MalformedBugIdentifier."""
 
250
        error = errors.MalformedBugIdentifier('bogus', 'reason for bogosity')
 
251
        self.assertEqual(
 
252
            "Did not understand bug identifier bogus: reason for bogosity",
 
253
            str(error))
 
254
 
 
255
    def test_unknown_bug_tracker_abbreviation(self):
 
256
        """Test the formatting of UnknownBugTrackerAbbreviation."""
 
257
        branch = self.make_branch('some_branch')
 
258
        error = errors.UnknownBugTrackerAbbreviation('xxx', branch)
 
259
        self.assertEqual(
 
260
            "Cannot find registered bug tracker called xxx on %s" % branch,
 
261
            str(error))
 
262
 
 
263
    def test_unexpected_smart_server_response(self):
 
264
        e = errors.UnexpectedSmartServerResponse(('not yes',))
 
265
        self.assertEqual(
 
266
            "Could not understand response from smart server: ('not yes',)",
 
267
            str(e))
236
268
 
237
269
 
238
270
class PassThroughError(errors.BzrError):