/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

Merge 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
    symbol_versioning,
24
25
    )
25
26
from bzrlib.tests import TestCase, TestCaseWithTransport
26
27
 
27
28
 
28
 
# TODO: Make sure builtin exception class formats are consistent - e.g. should
29
 
# or shouldn't end with a full stop, etc.
30
 
 
31
29
 
32
30
class TestErrors(TestCaseWithTransport):
33
31
 
142
140
            str(error))
143
141
 
144
142
    def test_read_only_lock_error(self):
145
 
        error = errors.ReadOnlyLockError('filename', 'error message')
 
143
        error = self.applyDeprecated(symbol_versioning.zero_ninetytwo,
 
144
            errors.ReadOnlyLockError, 'filename', 'error message')
146
145
        self.assertEqualDiff("Cannot acquire write lock on filename."
147
146
                             " error message", str(error))
148
147
 
 
148
    def test_lock_failed(self):
 
149
        error = errors.LockFailed('http://canonical.com/', 'readonly transport')
 
150
        self.assertEqualDiff("Cannot lock http://canonical.com/: readonly transport",
 
151
            str(error))
 
152
        self.assertFalse(error.internal_error)
 
153
 
149
154
    def test_too_many_concurrent_requests(self):
150
155
        error = errors.TooManyConcurrentRequests("a medium")
151
156
        self.assertEqualDiff("The medium 'a medium' has reached its concurrent "
361
366
        self.assertEqual(
362
367
            "Container has multiple records with the same name: n\xc3\xa5me",
363
368
            str(e))
 
369
        
 
370
    def test_check_error(self):
 
371
        # This has a member called 'message', which is problematic in
 
372
        # python2.5 because that is a slot on the base Exception class
 
373
        e = errors.BzrCheckError('example check failure')
 
374
        self.assertEqual(
 
375
            "Internal check failed: example check failure",
 
376
            str(e))
 
377
        self.assertTrue(e.internal_error)
 
378
 
 
379
    def test_repository_data_stream_error(self):
 
380
        """Test the formatting of RepositoryDataStreamError."""
 
381
        e = errors.RepositoryDataStreamError(u"my reason")
 
382
        self.assertEqual(
 
383
            "Corrupt or incompatible data stream: my reason", str(e))
364
384
 
365
385
 
366
386
class PassThroughError(errors.BzrError):