/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: Andrew Bennetts
  • Date: 2008-04-10 07:58:01 UTC
  • mfrom: (3352 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3357.
  • Revision ID: andrew.bennetts@canonical.com-20080410075801-n24st9wfiizkvszp
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    bzrdir,
23
23
    errors,
 
24
    osutils,
24
25
    symbol_versioning,
25
26
    urlutils,
26
27
    )
174
175
                             " tree atree.", str(error))
175
176
        self.assertIsInstance(error, errors.NoSuchRevision)
176
177
 
 
178
    def test_not_stacked(self):
 
179
        error = errors.NotStacked('a branch')
 
180
        self.assertEqualDiff("The branch 'a branch' is not stacked.",
 
181
            str(error))
 
182
 
177
183
    def test_not_write_locked(self):
178
184
        error = errors.NotWriteLocked('a thing to repr')
179
185
        self.assertEqualDiff("'a thing to repr' is not write locked but needs "
209
215
            " of bzrlib.",
210
216
            str(error))
211
217
 
 
218
    def test_unstackable_branch_format(self):
 
219
        format = u'foo'
 
220
        url = "/foo"
 
221
        error = errors.UnstackableBranchFormat(format, url)
 
222
        self.assertEqualDiff(
 
223
            "The branch '/foo'(foo) is not a stackable format. "
 
224
            "You will need to upgrade the branch to permit branch stacking.",
 
225
            str(error))
 
226
 
 
227
    def test_unstackable_repository_format(self):
 
228
        format = u'foo'
 
229
        url = "/foo"
 
230
        error = errors.UnstackableRepositoryFormat(format, url)
 
231
        self.assertEqualDiff(
 
232
            "The repository '/foo'(foo) is not a stackable format. "
 
233
            "You will need to upgrade the repository to permit branch stacking.",
 
234
            str(error))
 
235
 
212
236
    def test_up_to_date(self):
213
237
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
214
238
        self.assertEqualDiff("The branch format Bazaar-NG branch, "
445
469
            "Unable to create symlink u'\\xb5' on this platform",
446
470
            str(err))
447
471
 
 
472
    def test_invalid_url_join(self):
 
473
        """Test the formatting of InvalidURLJoin."""
 
474
        e = errors.InvalidURLJoin('Reason', 'base path', ('args',))
 
475
        self.assertEqual(
 
476
            "Invalid URL join request: Reason: 'base path' + ('args',)",
 
477
            str(e))
 
478
 
448
479
    def test_incorrect_url(self):
449
480
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
450
481
        self.assertEquals(
452
483
             "http://bug.com/"),
453
484
            str(err))
454
485
 
 
486
    def test_unable_encode_path(self):
 
487
        err = errors.UnableEncodePath('foo', 'executable')
 
488
        self.assertEquals("Unable to encode executable path 'foo' in "
 
489
            "user encoding " + osutils.get_user_encoding(),
 
490
            str(err))
 
491
 
 
492
    def test_unknown_format(self):
 
493
        err = errors.UnknownFormatError('bar', kind='foo')
 
494
        self.assertEquals("Unknown foo format: 'bar'", str(err))
 
495
 
455
496
 
456
497
class PassThroughError(errors.BzrError):
457
498