~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
            workingtree.format_registry.set_default(old_format)
78
78
        self.assertEqual(old_format, workingtree.format_registry.get_default())
79
79
 
80
 
    def test_get_set_default_format_by_key(self):
81
 
        old_format = workingtree.format_registry.get_default()
82
 
        # default is 3
83
 
        format = SampleTreeFormat()
84
 
        workingtree.format_registry.register(format)
85
 
        self.addCleanup(workingtree.format_registry.remove, format)
86
 
        self.assertTrue(isinstance(old_format, workingtree.WorkingTreeFormat3))
87
 
        workingtree.format_registry.set_default_key(format.get_format_string())
88
 
        try:
89
 
            # the default branch format is used by the meta dir format
90
 
            # which is not the default bzrdir format at this point
91
 
            dir = bzrdir.BzrDirMetaFormat1().initialize('.')
92
 
            dir.create_repository()
93
 
            dir.create_branch()
94
 
            result = dir.create_workingtree()
95
 
            self.assertEqual(result, 'A tree')
96
 
        finally:
97
 
            workingtree.format_registry.set_default_key(
98
 
                old_format.get_format_string())
99
 
        self.assertEqual(old_format, workingtree.format_registry.get_default())
100
 
 
101
80
    def test_open(self):
102
81
        tree = self.make_branch_and_tree('.')
103
82
        open_direct = workingtree.WorkingTree.open('.')
166
145
class TestWorkingTreeFormat(TestCaseWithTransport):
167
146
    """Tests for the WorkingTreeFormat facility."""
168
147
 
169
 
    def test_find_format_string(self):
170
 
        # is the right format object found for a working tree?
171
 
        branch = self.make_branch('branch')
172
 
        self.assertRaises(errors.NoWorkingTree,
173
 
            workingtree.WorkingTreeFormat.find_format_string, branch.bzrdir)
174
 
        transport = branch.bzrdir.get_workingtree_transport(None)
175
 
        transport.mkdir('.')
176
 
        transport.put_bytes("format", "some format name")
177
 
        # The format does not have to be known by Bazaar,
178
 
        # find_format_string just retrieves the name
179
 
        self.assertEquals("some format name",
180
 
            workingtree.WorkingTreeFormat.find_format_string(branch.bzrdir))
181
 
 
182
148
    def test_find_format(self):
183
149
        # is the right format object found for a working tree?
184
150
        # create a branch with a few known format objects.