~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_shared_repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-15 05:43:42 UTC
  • mfrom: (4734.4.13 bug-440952-bzrdir)
  • Revision ID: pqm@pqm.ubuntu.com-20100115054342-o6ar5y4ch9tcnzyi
(andrew) Give 'location is a repository' hint for NotBranchError
        (#440952).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib.bzrdir import BzrDir
 
21
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
22
22
import bzrlib.errors as errors
23
23
from bzrlib.tests import TestCaseInTempDir
24
24
 
120
120
        # become necessary for this use case. Please do not adjust this number
121
121
        # upwards without agreement from bzr's network support maintainers.
122
122
        self.assertLength(15, self.hpss_calls)
 
123
 
 
124
    def test_notification_on_branch_from_repository(self):
 
125
        out, err = self.run_bzr("init-repository -q a")
 
126
        self.assertEqual(out, "")
 
127
        self.assertEqual(err, "")
 
128
        dir = BzrDir.open('a')
 
129
        dir.open_repository() # there is a repository there
 
130
        e = self.assertRaises(errors.NotBranchError, dir.open_branch)
 
131
        self.assertContainsRe(str(e), "location is a repository")
 
132
 
 
133
    def test_notification_on_branch_from_nonrepository(self):
 
134
        fmt = BzrDirMetaFormat1()
 
135
        t = self.get_transport()
 
136
        t.mkdir('a')
 
137
        dir = fmt.initialize_on_transport(t.clone('a'))
 
138
        self.assertRaises(errors.NoRepositoryPresent, dir.open_repository)
 
139
        e = self.assertRaises(errors.NotBranchError, dir.open_branch)
 
140
        self.assertNotContainsRe(str(e), "location is a repository")