~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-21 17:22:25 UTC
  • mfrom: (5626.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110121172225-7mybq84k4ikcails
(vila) Merge 2.3 into trunk including bugfix for #701940 (Vincent
        Ladeuil)

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):
672
675
        err = errors.NotBranchError('path', bzrdir=bzrdir)
673
676
        self.assertEqual('Not a branch: "path".', str(err))
674
677
 
 
678
    def test_not_branch_bzrdir_with_recursive_not_branch_error(self):
 
679
        class FakeBzrDir(object):
 
680
            def open_repository(self):
 
681
                # str() on the NotBranchError will trigger a call to this,
 
682
                # which in turn will another, identical NotBranchError.
 
683
                raise errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
684
        err = errors.NotBranchError('path', bzrdir=FakeBzrDir())
 
685
        self.assertEqual('Not a branch: "path".', str(err))
 
686
 
675
687
    def test_not_branch_laziness(self):
676
688
        real_bzrdir = self.make_bzrdir('path')
677
689
        class FakeBzrDir(object):