~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
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")