~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Jelmer Vernooij
  • Date: 2010-12-20 11:57:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5577.
  • Revision ID: jelmer@samba.org-20101220115714-2ru3hfappjweeg7q
Don't use no-plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
2
 
#   Authors: Robert Collins <robert.collins@canonical.com>
3
 
#            and others
 
1
# Copyright (C) 2006-2010 Canonical Ltd
4
2
#
5
3
# This program is free software; you can redistribute it and/or modify
6
4
# it under the terms of the GNU General Public License as published by
14
12
#
15
13
# You should have received a copy of the GNU General Public License
16
14
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
16
 
19
17
"""Tests for the formatting and construction of errors."""
20
18
 
 
19
import inspect
 
20
import re
 
21
import socket
 
22
import sys
 
23
 
21
24
from bzrlib import (
22
25
    bzrdir,
23
26
    errors,
 
27
    osutils,
24
28
    symbol_versioning,
 
29
    urlutils,
25
30
    )
26
 
from bzrlib.tests import TestCase, TestCaseWithTransport
 
31
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
27
32
 
28
33
 
29
34
class TestErrors(TestCaseWithTransport):
30
35
 
 
36
    def test_no_arg_named_message(self):
 
37
        """Ensure the __init__ and _fmt in errors do not have "message" arg.
 
38
 
 
39
        This test fails if __init__ or _fmt in errors has an argument
 
40
        named "message" as this can cause errors in some Python versions.
 
41
        Python 2.5 uses a slot for StandardError.message.
 
42
        See bug #603461
 
43
        """
 
44
        fmt_pattern = re.compile("%\(message\)[sir]")
 
45
        subclasses_present = getattr(errors.BzrError, '__subclasses__', None)
 
46
        if not subclasses_present:
 
47
            raise TestSkipped('__subclasses__ attribute required for classes. '
 
48
                'Requires Python 2.5 or later.')
 
49
        for c in errors.BzrError.__subclasses__():
 
50
            init = getattr(c, '__init__', None)
 
51
            fmt = getattr(c, '_fmt', None)
 
52
            if init:
 
53
                args = inspect.getargspec(init)[0]
 
54
                self.assertFalse('message' in args,
 
55
                    ('Argument name "message" not allowed for '
 
56
                    '"errors.%s.__init__"' % c.__name__))
 
57
            if fmt and fmt_pattern.search(fmt):
 
58
                self.assertFalse(True, ('"message" not allowed in '
 
59
                    '"errors.%s._fmt"' % c.__name__))
 
60
 
 
61
    def test_bad_filename_encoding(self):
 
62
        error = errors.BadFilenameEncoding('bad/filen\xe5me', 'UTF-8')
 
63
        self.assertEqualDiff(
 
64
            "Filename 'bad/filen\\xe5me' is not valid in your current"
 
65
            " filesystem encoding UTF-8",
 
66
            str(error))
 
67
 
 
68
    def test_corrupt_dirstate(self):
 
69
        error = errors.CorruptDirstate('path/to/dirstate', 'the reason why')
 
70
        self.assertEqualDiff(
 
71
            "Inconsistency in dirstate file path/to/dirstate.\n"
 
72
            "Error: the reason why",
 
73
            str(error))
 
74
 
 
75
    def test_dirstate_corrupt(self):
 
76
        error = errors.DirstateCorrupt('.bzr/checkout/dirstate',
 
77
                                       'trailing garbage: "x"')
 
78
        self.assertEqualDiff("The dirstate file (.bzr/checkout/dirstate)"
 
79
            " appears to be corrupt: trailing garbage: \"x\"",
 
80
            str(error))
 
81
 
31
82
    def test_disabled_method(self):
32
83
        error = errors.DisabledMethod("class name")
33
84
        self.assertEqualDiff(
43
94
        self.assertEqualDiff('The prefix foo is in the help search path twice.',
44
95
            str(error))
45
96
 
 
97
    def test_ghost_revisions_have_no_revno(self):
 
98
        error = errors.GhostRevisionsHaveNoRevno('target', 'ghost_rev')
 
99
        self.assertEqualDiff("Could not determine revno for {target} because"
 
100
                             " its ancestry shows a ghost at {ghost_rev}",
 
101
                             str(error))
 
102
 
46
103
    def test_incompatibleAPI(self):
47
104
        error = errors.IncompatibleAPI("module", (1, 2, 3), (4, 5, 6), (7, 8, 9))
48
105
        self.assertEqualDiff(
50
107
            'It supports versions "(4, 5, 6)" to "(7, 8, 9)".',
51
108
            str(error))
52
109
 
 
110
    def test_inconsistent_delta(self):
 
111
        error = errors.InconsistentDelta('path', 'file-id', 'reason for foo')
 
112
        self.assertEqualDiff(
 
113
            "An inconsistent delta was supplied involving 'path', 'file-id'\n"
 
114
            "reason: reason for foo",
 
115
            str(error))
 
116
 
 
117
    def test_inconsistent_delta_delta(self):
 
118
        error = errors.InconsistentDeltaDelta([], 'reason')
 
119
        self.assertEqualDiff(
 
120
            "An inconsistent delta was supplied: []\nreason: reason",
 
121
            str(error))
 
122
 
53
123
    def test_in_process_transport(self):
54
124
        error = errors.InProcessTransport('fpp')
55
125
        self.assertEqualDiff(
56
126
            "The transport 'fpp' is only accessible within this process.",
57
127
            str(error))
58
128
 
 
129
    def test_invalid_http_range(self):
 
130
        error = errors.InvalidHttpRange('path',
 
131
                                        'Content-Range: potatoes 0-00/o0oo0',
 
132
                                        'bad range')
 
133
        self.assertEquals("Invalid http range"
 
134
                          " 'Content-Range: potatoes 0-00/o0oo0'"
 
135
                          " for path: bad range",
 
136
                          str(error))
 
137
 
 
138
    def test_invalid_range(self):
 
139
        error = errors.InvalidRange('path', 12, 'bad range')
 
140
        self.assertEquals("Invalid range access in path at 12: bad range",
 
141
                          str(error))
 
142
 
59
143
    def test_inventory_modified(self):
60
144
        error = errors.InventoryModified("a tree to be repred")
61
145
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
63
147
            "read without data loss.",
64
148
            str(error))
65
149
 
66
 
    def test_install_failed(self):
67
 
        error = errors.InstallFailed(['rev-one'])
68
 
        self.assertEqual("Could not install revisions:\nrev-one", str(error))
69
 
        error = errors.InstallFailed(['rev-one', 'rev-two'])
70
 
        self.assertEqual("Could not install revisions:\nrev-one, rev-two",
71
 
                         str(error))
72
 
        error = errors.InstallFailed([None])
73
 
        self.assertEqual("Could not install revisions:\nNone", str(error))
 
150
    def test_jail_break(self):
 
151
        error = errors.JailBreak("some url")
 
152
        self.assertEqualDiff("An attempt to access a url outside the server"
 
153
            " jail was made: 'some url'.",
 
154
            str(error))
74
155
 
75
156
    def test_lock_active(self):
76
157
        error = errors.LockActive("lock description")
78
159
            "cannot be broken.",
79
160
            str(error))
80
161
 
 
162
    def test_lock_corrupt(self):
 
163
        error = errors.LockCorrupt("corruption info")
 
164
        self.assertEqualDiff("Lock is apparently held, but corrupted: "
 
165
            "corruption info\n"
 
166
            "Use 'bzr break-lock' to clear it",
 
167
            str(error))
 
168
 
81
169
    def test_knit_data_stream_incompatible(self):
82
170
        error = errors.KnitDataStreamIncompatible(
83
171
            'stream format', 'target format')
85
173
                         '"stream format" into knit of format '
86
174
                         '"target format".', str(error))
87
175
 
 
176
    def test_knit_data_stream_unknown(self):
 
177
        error = errors.KnitDataStreamUnknown(
 
178
            'stream format')
 
179
        self.assertEqual('Cannot parse knit data stream of format '
 
180
                         '"stream format".', str(error))
 
181
 
88
182
    def test_knit_header_error(self):
89
183
        error = errors.KnitHeaderError('line foo\n', 'path/to/file')
90
184
        self.assertEqual("Knit header error: 'line foo\\n' unexpected"
101
195
        error = errors.MediumNotConnected("a medium")
102
196
        self.assertEqualDiff(
103
197
            "The medium 'a medium' is not connected.", str(error))
104
 
        
 
198
 
 
199
    def test_no_public_branch(self):
 
200
        b = self.make_branch('.')
 
201
        error = errors.NoPublicBranch(b)
 
202
        url = urlutils.unescape_for_display(b.base, 'ascii')
 
203
        self.assertEqualDiff(
 
204
            'There is no public branch set for "%s".' % url, str(error))
 
205
 
105
206
    def test_no_repo(self):
106
207
        dir = bzrdir.BzrDir.create(self.get_url())
107
208
        error = errors.NoRepositoryPresent(dir)
108
209
        self.assertNotEqual(-1, str(error).find((dir.transport.clone('..').base)))
109
210
        self.assertEqual(-1, str(error).find((dir.transport.base)))
110
 
        
 
211
 
111
212
    def test_no_smart_medium(self):
112
213
        error = errors.NoSmartMedium("a transport")
113
214
        self.assertEqualDiff("The transport 'a transport' cannot tunnel the "
132
233
                             " tree atree.", str(error))
133
234
        self.assertIsInstance(error, errors.NoSuchRevision)
134
235
 
 
236
    def test_not_stacked(self):
 
237
        error = errors.NotStacked('a branch')
 
238
        self.assertEqualDiff("The branch 'a branch' is not stacked.",
 
239
            str(error))
 
240
 
135
241
    def test_not_write_locked(self):
136
242
        error = errors.NotWriteLocked('a thing to repr')
137
243
        self.assertEqualDiff("'a thing to repr' is not write locked but needs "
138
244
            "to be.",
139
245
            str(error))
140
246
 
141
 
    def test_read_only_lock_error(self):
142
 
        error = self.applyDeprecated(symbol_versioning.zero_ninetytwo,
143
 
            errors.ReadOnlyLockError, 'filename', 'error message')
144
 
        self.assertEqualDiff("Cannot acquire write lock on filename."
145
 
                             " error message", str(error))
146
 
 
147
247
    def test_lock_failed(self):
148
248
        error = errors.LockFailed('http://canonical.com/', 'readonly transport')
149
249
        self.assertEqualDiff("Cannot lock http://canonical.com/: readonly transport",
157
257
            "the currently open request.",
158
258
            str(error))
159
259
 
 
260
    def test_unavailable_representation(self):
 
261
        error = errors.UnavailableRepresentation(('key',), "mpdiff", "fulltext")
 
262
        self.assertEqualDiff("The encoding 'mpdiff' is not available for key "
 
263
            "('key',) which is encoded as 'fulltext'.",
 
264
            str(error))
 
265
 
160
266
    def test_unknown_hook(self):
161
267
        error = errors.UnknownHook("branch", "foo")
162
268
        self.assertEqualDiff("The branch hook 'foo' is unknown in this version"
167
273
            " of bzrlib.",
168
274
            str(error))
169
275
 
 
276
    def test_unstackable_branch_format(self):
 
277
        format = u'foo'
 
278
        url = "/foo"
 
279
        error = errors.UnstackableBranchFormat(format, url)
 
280
        self.assertEqualDiff(
 
281
            "The branch '/foo'(foo) is not a stackable format. "
 
282
            "You will need to upgrade the branch to permit branch stacking.",
 
283
            str(error))
 
284
 
 
285
    def test_unstackable_location(self):
 
286
        error = errors.UnstackableLocationError('foo', 'bar')
 
287
        self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.",
 
288
            str(error))
 
289
 
 
290
    def test_unstackable_repository_format(self):
 
291
        format = u'foo'
 
292
        url = "/foo"
 
293
        error = errors.UnstackableRepositoryFormat(format, url)
 
294
        self.assertEqualDiff(
 
295
            "The repository '/foo'(foo) is not a stackable format. "
 
296
            "You will need to upgrade the repository to permit branch stacking.",
 
297
            str(error))
 
298
 
170
299
    def test_up_to_date(self):
171
300
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
172
 
        self.assertEqualDiff("The branch format Bazaar-NG branch, "
173
 
                             "format 0.0.4 is already at the most "
 
301
        self.assertEqualDiff("The branch format All-in-one "
 
302
                             "format 4 is already at the most "
174
303
                             "recent format.",
175
304
                             str(error))
176
305
 
304
433
            host='ahost', port=444, msg='Unable to connect to ssh host',
305
434
            orig_error='my_error')
306
435
 
 
436
    def test_target_not_branch(self):
 
437
        """Test the formatting of TargetNotBranch."""
 
438
        error = errors.TargetNotBranch('foo')
 
439
        self.assertEqual(
 
440
            "Your branch does not have all of the revisions required in "
 
441
            "order to merge this merge directive and the target "
 
442
            "location specified in the merge directive is not a branch: "
 
443
            "foo.", str(error))
 
444
 
307
445
    def test_malformed_bug_identifier(self):
308
446
        """Test the formatting of MalformedBugIdentifier."""
309
447
        error = errors.MalformedBugIdentifier('bogus', 'reason for bogosity')
310
448
        self.assertEqual(
311
 
            "Did not understand bug identifier bogus: reason for bogosity",
 
449
            'Did not understand bug identifier bogus: reason for bogosity. '
 
450
            'See "bzr help bugs" for more information on this feature.',
312
451
            str(error))
313
452
 
314
453
    def test_unknown_bug_tracker_abbreviation(self):
365
504
        self.assertEqual(
366
505
            "Container has multiple records with the same name: n\xc3\xa5me",
367
506
            str(e))
368
 
        
 
507
 
369
508
    def test_check_error(self):
370
509
        # This has a member called 'message', which is problematic in
371
510
        # python2.5 because that is a slot on the base Exception class
403
542
            "Unable to create symlink u'\\xb5' on this platform",
404
543
            str(err))
405
544
 
 
545
    def test_invalid_url_join(self):
 
546
        """Test the formatting of InvalidURLJoin."""
 
547
        e = errors.InvalidURLJoin('Reason', 'base path', ('args',))
 
548
        self.assertEqual(
 
549
            "Invalid URL join request: Reason: 'base path' + ('args',)",
 
550
            str(e))
 
551
 
 
552
    def test_incorrect_url(self):
 
553
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
 
554
        self.assertEquals(
 
555
            ("The URL for bug tracker \"foo\" doesn't contain {id}: "
 
556
             "http://bug.com/"),
 
557
            str(err))
 
558
 
 
559
    def test_unable_encode_path(self):
 
560
        err = errors.UnableEncodePath('foo', 'executable')
 
561
        self.assertEquals("Unable to encode executable path 'foo' in "
 
562
            "user encoding " + osutils.get_user_encoding(),
 
563
            str(err))
 
564
 
 
565
    def test_unknown_format(self):
 
566
        err = errors.UnknownFormatError('bar', kind='foo')
 
567
        self.assertEquals("Unknown foo format: 'bar'", str(err))
 
568
 
 
569
    def test_unknown_rules(self):
 
570
        err = errors.UnknownRules(['foo', 'bar'])
 
571
        self.assertEquals("Unknown rules detected: foo, bar.", str(err))
 
572
 
 
573
    def test_hook_failed(self):
 
574
        # Create an exc_info tuple by raising and catching an exception.
 
575
        try:
 
576
            1/0
 
577
        except ZeroDivisionError:
 
578
            exc_info = sys.exc_info()
 
579
        err = errors.HookFailed('hook stage', 'hook name', exc_info, warn=False)
 
580
        self.assertStartsWith(
 
581
            str(err), 'Hook \'hook name\' during hook stage failed:\n')
 
582
        self.assertEndsWith(
 
583
            str(err), 'integer division or modulo by zero')
 
584
 
 
585
    def test_tip_change_rejected(self):
 
586
        err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
 
587
        self.assertEquals(
 
588
            u'Tip change rejected: Unicode message\N{INTERROBANG}',
 
589
            unicode(err))
 
590
        self.assertEquals(
 
591
            'Tip change rejected: Unicode message\xe2\x80\xbd',
 
592
            str(err))
 
593
 
 
594
    def test_error_from_smart_server(self):
 
595
        error_tuple = ('error', 'tuple')
 
596
        err = errors.ErrorFromSmartServer(error_tuple)
 
597
        self.assertEquals(
 
598
            "Error received from smart server: ('error', 'tuple')", str(err))
 
599
 
 
600
    def test_untranslateable_error_from_smart_server(self):
 
601
        error_tuple = ('error', 'tuple')
 
602
        orig_err = errors.ErrorFromSmartServer(error_tuple)
 
603
        err = errors.UnknownErrorFromSmartServer(orig_err)
 
604
        self.assertEquals(
 
605
            "Server sent an unexpected error: ('error', 'tuple')", str(err))
 
606
 
 
607
    def test_smart_message_handler_error(self):
 
608
        # Make an exc_info tuple.
 
609
        try:
 
610
            raise Exception("example error")
 
611
        except Exception:
 
612
            exc_info = sys.exc_info()
 
613
        err = errors.SmartMessageHandlerError(exc_info)
 
614
        self.assertStartsWith(
 
615
            str(err), "The message handler raised an exception:\n")
 
616
        self.assertEndsWith(str(err), "Exception: example error\n")
 
617
 
 
618
    def test_must_have_working_tree(self):
 
619
        err = errors.MustHaveWorkingTree('foo', 'bar')
 
620
        self.assertEqual(str(err), "Branching 'bar'(foo) must create a"
 
621
                                   " working tree.")
 
622
 
 
623
    def test_no_such_view(self):
 
624
        err = errors.NoSuchView('foo')
 
625
        self.assertEquals("No such view: foo.", str(err))
 
626
 
 
627
    def test_views_not_supported(self):
 
628
        err = errors.ViewsNotSupported('atree')
 
629
        err_str = str(err)
 
630
        self.assertStartsWith(err_str, "Views are not supported by ")
 
631
        self.assertEndsWith(err_str, "; use 'bzr upgrade' to change your "
 
632
            "tree to a later format.")
 
633
 
 
634
    def test_file_outside_view(self):
 
635
        err = errors.FileOutsideView('baz', ['foo', 'bar'])
 
636
        self.assertEquals('Specified file "baz" is outside the current view: '
 
637
            'foo, bar', str(err))
 
638
 
 
639
    def test_invalid_shelf_id(self):
 
640
        invalid_id = "foo"
 
641
        err = errors.InvalidShelfId(invalid_id)
 
642
        self.assertEqual('"foo" is not a valid shelf id, '
 
643
            'try a number instead.', str(err))
 
644
 
 
645
    def test_unresumable_write_group(self):
 
646
        repo = "dummy repo"
 
647
        wg_tokens = ['token']
 
648
        reason = "a reason"
 
649
        err = errors.UnresumableWriteGroup(repo, wg_tokens, reason)
 
650
        self.assertEqual(
 
651
            "Repository dummy repo cannot resume write group "
 
652
            "['token']: a reason", str(err))
 
653
 
 
654
    def test_unsuspendable_write_group(self):
 
655
        repo = "dummy repo"
 
656
        err = errors.UnsuspendableWriteGroup(repo)
 
657
        self.assertEqual(
 
658
            'Repository dummy repo cannot suspend a write group.', str(err))
 
659
 
 
660
    def test_not_branch_no_args(self):
 
661
        err = errors.NotBranchError('path')
 
662
        self.assertEqual('Not a branch: "path".', str(err))
 
663
 
 
664
    def test_not_branch_bzrdir_with_repo(self):
 
665
        bzrdir = self.make_repository('repo').bzrdir
 
666
        err = errors.NotBranchError('path', bzrdir=bzrdir)
 
667
        self.assertEqual(
 
668
            'Not a branch: "path": location is a repository.', str(err))
 
669
 
 
670
    def test_not_branch_bzrdir_without_repo(self):
 
671
        bzrdir = self.make_bzrdir('bzrdir')
 
672
        err = errors.NotBranchError('path', bzrdir=bzrdir)
 
673
        self.assertEqual('Not a branch: "path".', str(err))
 
674
 
 
675
    def test_not_branch_bzrdir_with_recursive_not_branch_error(self):
 
676
        class FakeBzrDir(object):
 
677
            def open_repository(self):
 
678
                # str() on the NotBranchError will trigger a call to this,
 
679
                # which in turn will another, identical NotBranchError.
 
680
                raise errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
681
        err = errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
682
        self.assertEqual('Not a branch: "path".', str(err))
 
683
 
 
684
    def test_not_branch_laziness(self):
 
685
        real_bzrdir = self.make_bzrdir('path')
 
686
        class FakeBzrDir(object):
 
687
            def __init__(self):
 
688
                self.calls = []
 
689
            def open_repository(self):
 
690
                self.calls.append('open_repository')
 
691
                raise errors.NoRepositoryPresent(real_bzrdir)
 
692
        fake_bzrdir = FakeBzrDir()
 
693
        err = errors.NotBranchError('path', bzrdir=fake_bzrdir)
 
694
        self.assertEqual([], fake_bzrdir.calls)
 
695
        str(err)
 
696
        self.assertEqual(['open_repository'], fake_bzrdir.calls)
 
697
        # Stringifying twice doesn't try to open a repository twice.
 
698
        str(err)
 
699
        self.assertEqual(['open_repository'], fake_bzrdir.calls)
 
700
 
 
701
    def test_invalid_pattern(self):
 
702
        error = errors.InvalidPattern('Bad pattern msg.')
 
703
        self.assertEqualDiff("Invalid pattern(s) found. Bad pattern msg.",
 
704
            str(error))
 
705
 
 
706
    def test_recursive_bind(self):
 
707
        error = errors.RecursiveBind('foo_bar_branch')
 
708
        msg = ('Branch "foo_bar_branch" appears to be bound to itself. '
 
709
            'Please use `bzr unbind` to fix.')
 
710
        self.assertEqualDiff(msg, str(error))
 
711
 
406
712
 
407
713
class PassThroughError(errors.BzrError):
408
 
    
 
714
 
409
715
    _fmt = """Pass through %(foo)s and %(bar)s"""
410
716
 
411
717
    def __init__(self, foo, bar):
418
724
 
419
725
 
420
726
class ErrorWithNoFormat(errors.BzrError):
421
 
    """This class has a docstring but no format string."""
 
727
    __doc__ = """This class has a docstring but no format string."""
422
728
 
423
729
 
424
730
class TestErrorFormatting(TestCase):
425
 
    
 
731
 
426
732
    def test_always_str(self):
427
733
        e = PassThroughError(u'\xb5', 'bar')
428
734
        self.assertIsInstance(e.__str__(), str)
439
745
                ['ErrorWithNoFormat uses its docstring as a format, it should use _fmt instead'],
440
746
                lambda x: str(x), e)
441
747
        ## s = str(e)
442
 
        self.assertEqual(s, 
 
748
        self.assertEqual(s,
443
749
                "This class has a docstring but no format string.")
444
750
 
445
751
    def test_mismatched_format_args(self):
449
755
        e = ErrorWithBadFormat(not_thing='x')
450
756
        self.assertStartsWith(
451
757
            str(e), 'Unprintable exception ErrorWithBadFormat')
 
758
 
 
759
    def test_cannot_bind_address(self):
 
760
        # see <https://bugs.launchpad.net/bzr/+bug/286871>
 
761
        e = errors.CannotBindAddress('example.com', 22,
 
762
            socket.error(13, 'Permission denied'))
 
763
        self.assertContainsRe(str(e),
 
764
            r'Cannot bind address "example\.com:22":.*Permission denied')
 
765
 
 
766
    def test_file_timestamp_unavailable(self):            
 
767
        e = errors.FileTimestampUnavailable("/path/foo")
 
768
        self.assertEquals("The filestamp for /path/foo is not available.",
 
769
            str(e))
 
770
            
 
771
    def test_transform_rename_failed(self):
 
772
        e = errors.TransformRenameFailed(u"from", u"to", "readonly file", 2)
 
773
        self.assertEquals(
 
774
            u"Failed to rename from to to: readonly file",
 
775
            str(e))