/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_errors.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-08 14:55:19 UTC
  • mfrom: (3530 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3532.
  • Revision ID: john@arbash-meinel.com-20080708145519-paqg4kjwbpgs2xmq
Merge bzr.dev 3530

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        self.assertEqualDiff('The prefix foo is in the help search path twice.',
60
60
            str(error))
61
61
 
 
62
    def test_ghost_revisions_have_no_revno(self):
 
63
        error = errors.GhostRevisionsHaveNoRevno('target', 'ghost_rev')
 
64
        self.assertEqualDiff("Could not determine revno for {target} because"
 
65
                             " its ancestry shows a ghost at {ghost_rev}",
 
66
                             str(error))
 
67
 
62
68
    def test_incompatibleAPI(self):
63
69
        error = errors.IncompatibleAPI("module", (1, 2, 3), (4, 5, 6), (7, 8, 9))
64
70
        self.assertEqualDiff(
182
188
                             " tree atree.", str(error))
183
189
        self.assertIsInstance(error, errors.NoSuchRevision)
184
190
 
 
191
    def test_not_stacked(self):
 
192
        error = errors.NotStacked('a branch')
 
193
        self.assertEqualDiff("The branch 'a branch' is not stacked.",
 
194
            str(error))
 
195
 
185
196
    def test_not_write_locked(self):
186
197
        error = errors.NotWriteLocked('a thing to repr')
187
198
        self.assertEqualDiff("'a thing to repr' is not write locked but needs "
188
199
            "to be.",
189
200
            str(error))
190
201
 
191
 
    def test_read_only_lock_error(self):
192
 
        error = self.applyDeprecated(symbol_versioning.zero_ninetytwo,
193
 
            errors.ReadOnlyLockError, 'filename', 'error message')
194
 
        self.assertEqualDiff("Cannot acquire write lock on filename."
195
 
                             " error message", str(error))
196
 
 
197
202
    def test_lock_failed(self):
198
203
        error = errors.LockFailed('http://canonical.com/', 'readonly transport')
199
204
        self.assertEqualDiff("Cannot lock http://canonical.com/: readonly transport",
207
212
            "the currently open request.",
208
213
            str(error))
209
214
 
 
215
    def test_unavailable_representation(self):
 
216
        error = errors.UnavailableRepresentation(('key',), "mpdiff", "fulltext")
 
217
        self.assertEqualDiff("The encoding 'mpdiff' is not available for key "
 
218
            "('key',) which is encoded as 'fulltext'.",
 
219
            str(error))
 
220
 
210
221
    def test_unknown_hook(self):
211
222
        error = errors.UnknownHook("branch", "foo")
212
223
        self.assertEqualDiff("The branch hook 'foo' is unknown in this version"
217
228
            " of bzrlib.",
218
229
            str(error))
219
230
 
 
231
    def test_unstackable_branch_format(self):
 
232
        format = u'foo'
 
233
        url = "/foo"
 
234
        error = errors.UnstackableBranchFormat(format, url)
 
235
        self.assertEqualDiff(
 
236
            "The branch '/foo'(foo) is not a stackable format. "
 
237
            "You will need to upgrade the branch to permit branch stacking.",
 
238
            str(error))
 
239
 
 
240
    def test_unstackable_repository_format(self):
 
241
        format = u'foo'
 
242
        url = "/foo"
 
243
        error = errors.UnstackableRepositoryFormat(format, url)
 
244
        self.assertEqualDiff(
 
245
            "The repository '/foo'(foo) is not a stackable format. "
 
246
            "You will need to upgrade the repository to permit branch stacking.",
 
247
            str(error))
 
248
 
220
249
    def test_up_to_date(self):
221
250
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
222
251
        self.assertEqualDiff("The branch format Bazaar-NG branch, "
453
482
            "Unable to create symlink u'\\xb5' on this platform",
454
483
            str(err))
455
484
 
 
485
    def test_invalid_url_join(self):
 
486
        """Test the formatting of InvalidURLJoin."""
 
487
        e = errors.InvalidURLJoin('Reason', 'base path', ('args',))
 
488
        self.assertEqual(
 
489
            "Invalid URL join request: Reason: 'base path' + ('args',)",
 
490
            str(e))
 
491
 
456
492
    def test_incorrect_url(self):
457
493
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
458
494
        self.assertEquals(
470
506
        err = errors.UnknownFormatError('bar', kind='foo')
471
507
        self.assertEquals("Unknown foo format: 'bar'", str(err))
472
508
 
 
509
    def test_unknown_rules(self):
 
510
        err = errors.UnknownRules(['foo', 'bar'])
 
511
        self.assertEquals("Unknown rules detected: foo, bar.", str(err))
 
512
 
473
513
 
474
514
class PassThroughError(errors.BzrError):
475
515