~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Martin
  • Date: 2011-04-15 21:22:57 UTC
  • mto: This revision was merged to the branch mainline in revision 5797.
  • Revision ID: gzlist@googlemail.com-20110415212257-jgtovwwp4be7egd9
Add release notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
25
25
    bzrdir,
26
26
    errors,
27
27
    osutils,
28
 
    symbol_versioning,
29
28
    urlutils,
30
29
    )
31
 
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
 
30
from bzrlib.tests import (
 
31
    TestCase,
 
32
    TestCaseWithTransport,
 
33
    TestSkipped,
 
34
    )
32
35
 
33
36
 
34
37
class TestErrors(TestCaseWithTransport):
297
300
            str(error))
298
301
 
299
302
    def test_up_to_date(self):
300
 
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
301
 
        self.assertEqualDiff("The branch format All-in-one "
302
 
                             "format 4 is already at the most "
303
 
                             "recent format.",
304
 
                             str(error))
 
303
        error = errors.UpToDateFormat("someformat")
 
304
        self.assertEqualDiff(
 
305
            "The branch format someformat is already at the most "
 
306
            "recent format.", str(error))
305
307
 
306
308
    def test_corrupt_repository(self):
307
309
        repo = self.make_repository('.')
672
674
        err = errors.NotBranchError('path', bzrdir=bzrdir)
673
675
        self.assertEqual('Not a branch: "path".', str(err))
674
676
 
 
677
    def test_not_branch_bzrdir_with_recursive_not_branch_error(self):
 
678
        class FakeBzrDir(object):
 
679
            def open_repository(self):
 
680
                # str() on the NotBranchError will trigger a call to this,
 
681
                # which in turn will another, identical NotBranchError.
 
682
                raise errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
683
        err = errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
684
        self.assertEqual('Not a branch: "path".', str(err))
 
685
 
675
686
    def test_not_branch_laziness(self):
676
687
        real_bzrdir = self.make_bzrdir('path')
677
688
        class FakeBzrDir(object):