~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 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
36
36
    )
37
37
import bzrlib.branch
38
38
from bzrlib.errors import (NotBranchError,
39
 
                           NoColocatedBranchSupport,
40
39
                           UnknownFormatError,
41
40
                           UnsupportedFormatError,
42
41
                           )
51
50
    http_utils,
52
51
    )
53
52
from bzrlib.tests.test_http import TestWithTransport_pycurl
54
 
from bzrlib.transport import (
55
 
    get_transport,
56
 
    memory,
57
 
    )
 
53
from bzrlib.transport import get_transport
58
54
from bzrlib.transport.http._urllib import HttpTransport_urllib
 
55
from bzrlib.transport.memory import MemoryServer
59
56
from bzrlib.transport.nosmart import NoSmartTransportDecorator
60
57
from bzrlib.transport.readonly import ReadonlyTransportDecorator
61
58
from bzrlib.repofmt import knitrepo, weaverepo, pack_repo
148
145
        new = topics.get_detail('current-formats')
149
146
        rest = topics.get_detail('other-formats')
150
147
        experimental, deprecated = rest.split('Deprecated formats')
151
 
        self.assertContainsRe(new, 'formats-help')
 
148
        self.assertContainsRe(new, 'bzr help formats')
152
149
        self.assertContainsRe(new,
153
150
                ':knit:\n    \(native\) \(default\) Format using knits\n')
154
151
        self.assertContainsRe(experimental,
207
204
        """See BzrDir.open_repository."""
208
205
        return SampleRepository(self)
209
206
 
210
 
    def create_branch(self, name=None):
 
207
    def create_branch(self):
211
208
        """See BzrDir.create_branch."""
212
 
        if name is not None:
213
 
            raise NoColocatedBranchSupport(self)
214
209
        return SampleBranch(self)
215
210
 
216
211
    def create_workingtree(self):
359
354
 
360
355
    def test_create_branch_convenience_root(self):
361
356
        """Creating a branch at the root of a fs should work."""
362
 
        self.vfs_transport_factory = memory.MemoryServer
 
357
        self.vfs_transport_factory = MemoryServer
363
358
        # outside a repo the default convenience output is a repo+branch_tree
364
359
        format = bzrdir.format_registry.make_bzrdir('knit')
365
360
        branch = bzrdir.BzrDir.create_branch_convenience(self.get_url(),
471
466
        # Make stackable source branch with an unstackable repo format.
472
467
        source_bzrdir = self.make_bzrdir('source')
473
468
        pack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
474
 
        source_branch = bzrlib.branch.BzrBranchFormat7().initialize(
475
 
            source_bzrdir)
 
469
        source_branch = bzrlib.branch.BzrBranchFormat7().initialize(source_bzrdir)
476
470
        # Make a directory with a default stacking policy
477
471
        parent_bzrdir = self.make_bzrdir('parent')
478
472
        stacked_on = self.make_branch('parent/stacked-on', format='pack-0.92')
571
565
 
572
566
    def setUp(self):
573
567
        super(ChrootedTests, self).setUp()
574
 
        if not self.vfs_transport_factory == memory.MemoryServer:
 
568
        if not self.vfs_transport_factory == MemoryServer:
575
569
            self.transport_readonly_server = http_server.HttpServer
576
570
 
577
571
    def local_branch_path(self, branch):
1055
1049
 
1056
1050
    def setUp(self):
1057
1051
        super(NonLocalTests, self).setUp()
1058
 
        self.vfs_transport_factory = memory.MemoryServer
 
1052
        self.vfs_transport_factory = MemoryServer
1059
1053
 
1060
1054
    def test_create_branch_convenience(self):
1061
1055
        # outside a repo the default convenience output is a repo+branch_tree
1158
1152
    _transport = HttpTransport_urllib
1159
1153
 
1160
1154
    def _qualified_url(self, host, port):
1161
 
        result = 'http+urllib://%s:%s' % (host, port)
1162
 
        self.permit_url(result)
1163
 
        return result
 
1155
        return 'http+urllib://%s:%s' % (host, port)
1164
1156
 
1165
1157
 
1166
1158
 
1170
1162
    """Tests redirections for pycurl implementation"""
1171
1163
 
1172
1164
    def _qualified_url(self, host, port):
1173
 
        result = 'http+pycurl://%s:%s' % (host, port)
1174
 
        self.permit_url(result)
1175
 
        return result
 
1165
        return 'http+pycurl://%s:%s' % (host, port)
1176
1166
 
1177
1167
 
1178
1168
class TestHTTPRedirections_nosmart(TestHTTPRedirections,
1182
1172
    _transport = NoSmartTransportDecorator
1183
1173
 
1184
1174
    def _qualified_url(self, host, port):
1185
 
        result = 'nosmart+http://%s:%s' % (host, port)
1186
 
        self.permit_url(result)
1187
 
        return result
 
1175
        return 'nosmart+http://%s:%s' % (host, port)
1188
1176
 
1189
1177
 
1190
1178
class TestHTTPRedirections_readonly(TestHTTPRedirections,
1194
1182
    _transport = ReadonlyTransportDecorator
1195
1183
 
1196
1184
    def _qualified_url(self, host, port):
1197
 
        result = 'readonly+http://%s:%s' % (host, port)
1198
 
        self.permit_url(result)
1199
 
        return result
 
1185
        return 'readonly+http://%s:%s' % (host, port)
1200
1186
 
1201
1187
 
1202
1188
class TestDotBzrHidden(TestCaseWithTransport):
1339
1325
        url = transport.base
1340
1326
        err = self.assertRaises(errors.BzrError, bzrdir.BzrDir.open, url)
1341
1327
        self.assertEqual('fail', err._preformatted_string)
1342
 
 
1343
 
    def test_post_repo_init(self):
1344
 
        from bzrlib.bzrdir import RepoInitHookParams
1345
 
        calls = []
1346
 
        bzrdir.BzrDir.hooks.install_named_hook('post_repo_init',
1347
 
            calls.append, None)
1348
 
        self.make_repository('foo')
1349
 
        self.assertLength(1, calls)
1350
 
        params = calls[0]
1351
 
        self.assertIsInstance(params, RepoInitHookParams)
1352
 
        self.assertTrue(hasattr(params, 'bzrdir'))
1353
 
        self.assertTrue(hasattr(params, 'repository'))