27
27
class TestErrors(TestCaseWithTransport):
29
def test_medium_not_connected(self):
30
error = errors.MediumNotConnected("a medium")
32
"The medium 'a medium' is not connected.", str(error))
29
34
def test_no_repo(self):
30
35
dir = bzrdir.BzrDir.create(self.get_url())
31
36
error = errors.NoRepositoryPresent(dir)
32
37
self.assertNotEqual(-1, str(error).find((dir.transport.clone('..').base)))
33
38
self.assertEqual(-1, str(error).find((dir.transport.base)))
40
def test_no_smart_medium(self):
41
error = errors.NoSmartMedium("a transport")
42
self.assertEqualDiff("The transport 'a transport' cannot tunnel the "
35
46
def test_no_such_id(self):
36
47
error = errors.NoSuchId("atree", "anid")
37
48
self.assertEqualDiff("The file id anid is not present in the tree "
52
def test_too_many_concurrent_requests(self):
53
error = errors.TooManyConcurrentRequests("a medium")
54
self.assertEqualDiff("The medium 'a medium' has reached its concurrent "
55
"request limit. Be sure to finish_writing and finish_reading on "
56
"the current request that is open.",
41
59
def test_up_to_date(self):
42
60
error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
43
61
self.assertEqualDiff("The branch format Bazaar-NG branch, "
53
71
repo.bzrdir.root_transport.base,
74
def test_reading_completed(self):
75
error = errors.ReadingCompleted("a request")
76
self.assertEqualDiff("The MediumRequest 'a request' has already had "
77
"finish_reading called upon it - the request has been completed and"
78
" no more data may be read.",
81
def test_writing_completed(self):
82
error = errors.WritingCompleted("a request")
83
self.assertEqualDiff("The MediumRequest 'a request' has already had "
84
"finish_writing called upon it - accept bytes may not be called "
88
def test_writing_not_completed(self):
89
error = errors.WritingNotComplete("a request")
90
self.assertEqualDiff("The MediumRequest 'a request' has not has "
91
"finish_writing called upon it - until the write phase is complete"
92
" no data may be read.",
57
96
class PassThroughError(errors.BzrNewError):
58
97
"""Pass through %(foo)s and %(bar)s"""