bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
1 |
# Copyright (C) 2010 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
"""Tests for bzr directories that support colocated branches."""
|
|
18 |
||
19 |
import bzrlib.branch |
|
|
5609.9.1
by Martin
Blindly change all users of get_transport to address the function via the transport module |
20 |
from bzrlib import ( |
21 |
errors, |
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
22 |
tests, |
|
5609.9.1
by Martin
Blindly change all users of get_transport to address the function via the transport module |
23 |
transport, |
24 |
)
|
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
25 |
from bzrlib.tests import ( |
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
26 |
per_controldir, |
27 |
)
|
|
28 |
||
29 |
||
30 |
class TestColocatedBranchSupport(per_controldir.TestCaseWithControlDir): |
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
31 |
|
32 |
def test_destroy_colocated_branch(self): |
|
33 |
branch = self.make_branch('branch') |
|
34 |
bzrdir = branch.bzrdir |
|
35 |
colo_branch = bzrdir.create_branch('colo') |
|
36 |
bzrdir.destroy_branch("colo") |
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
37 |
self.assertRaises(errors.NotBranchError, bzrdir.open_branch, |
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
38 |
"colo") |
39 |
||
40 |
def test_create_colo_branch(self): |
|
41 |
# a bzrdir can construct a branch and repository for itself.
|
|
42 |
if not self.bzrdir_format.is_supported(): |
|
43 |
# unsupported formats are not loopback testable
|
|
44 |
# because the default open will not open them and
|
|
45 |
# they may not be initializable.
|
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
46 |
raise tests.TestNotApplicable('Control dir format not supported') |
47 |
t = self.get_transport() |
|
|
5143.1.2
by Jelmer Vernooij
Allow create_branch to raise UninitializableFormat. |
48 |
try: |
49 |
made_control = self.bzrdir_format.initialize(t.base) |
|
50 |
except errors.UninitializableFormat: |
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
51 |
raise tests.TestNotApplicable( |
52 |
'Control dir does not support creating new branches.') |
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
53 |
made_repo = made_control.create_repository() |
54 |
made_branch = made_control.create_branch("colo") |
|
55 |
self.failUnless(isinstance(made_branch, bzrlib.branch.Branch)) |
|
56 |
self.assertEqual(made_control, made_branch.bzrdir) |