~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_controldir_colo/test_unsupported.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Canonical Ltd
 
1
# Copyright (C) 2010, 2011, 2012, 2016 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
20
20
and attributes colocated branch support added should fail in known ways.
21
21
"""
22
22
 
23
 
from bzrlib import errors
 
23
from bzrlib import (
 
24
    errors,
 
25
    tests,
 
26
    )
24
27
from bzrlib.tests import (
25
 
    TestNotApplicable,
26
 
    )
27
 
from bzrlib.transport import (
28
 
    get_transport,
29
 
    )
30
 
 
31
 
from bzrlib.tests.per_controldir_colo import (
32
 
    TestCaseWithControlDir,
33
 
    )
34
 
 
35
 
 
36
 
class TestNoColocatedSupport(TestCaseWithControlDir):
 
28
    per_controldir,
 
29
    )
 
30
 
 
31
 
 
32
class TestNoColocatedSupport(per_controldir.TestCaseWithControlDir):
37
33
 
38
34
    def make_bzrdir_with_repo(self):
39
35
        # a bzrdir can construct a branch and repository for itself.
41
37
            # unsupported formats are not loopback testable
42
38
            # because the default open will not open them and
43
39
            # they may not be initializable.
44
 
            raise TestNotApplicable('Control dir format not supported')
45
 
        t = get_transport(self.get_url())
46
 
        made_control = self.bzrdir_format.initialize(t.base)
 
40
            raise tests.TestNotApplicable('Control dir format not supported')
 
41
        t = self.get_transport()
 
42
        try:
 
43
            made_control = self.make_bzrdir('.', format=self.bzrdir_format)
 
44
        except errors.UninitializableFormat:
 
45
            raise tests.TestNotApplicable('Control dir format not initializable')
 
46
        self.assertEqual(made_control._format, self.bzrdir_format)
47
47
        made_repo = made_control.create_repository()
48
48
        return made_control
49
49
 
60
60
        self.assertRaises(errors.NoColocatedBranchSupport, 
61
61
            made_control.create_branch, "colo")
62
62
 
63
 
    def test_branch_transport(self):
 
63
    def test_open_branch(self):
64
64
        made_control = self.make_bzrdir_with_repo()
65
65
        self.assertRaises(errors.NoColocatedBranchSupport,
66
 
            made_control.get_branch_transport, None, "colo")
 
66
            made_control.open_branch, name="colo")
67
67
 
68
68
    def test_get_branch_reference(self):
69
69
        made_control = self.make_bzrdir_with_repo()
70
70
        self.assertRaises(errors.NoColocatedBranchSupport,
71
71
            made_control.get_branch_reference, "colo")
 
72
 
 
73
    def test_set_branch_reference(self):
 
74
        referenced = self.make_branch('referenced')
 
75
        made_control = self.make_bzrdir_with_repo()
 
76
        self.assertRaises(errors.NoColocatedBranchSupport,
 
77
            made_control.set_branch_reference, referenced, name="colo")
 
78
 
 
79
    def test_get_branches(self):
 
80
        made_control = self.make_bzrdir_with_repo()
 
81
        made_control.create_branch()
 
82
        self.assertEqual(made_control.get_branches().keys(),
 
83
                         [""])