/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_read_bundle.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test read_bundle works properly across various transports."""
18
18
 
19
 
import breezy.bundle
20
 
from ..bundle.serializer import write_bundle
21
 
import breezy.bzr.bzrdir
22
 
from .. import errors
23
 
from ..sixish import (
24
 
    BytesIO,
25
 
    )
26
 
from .. import tests
27
 
from .test_transport import TestTransportImplementation
28
 
from .per_transport import transport_test_permutations
29
 
import breezy.transport
30
 
import breezy.urlutils
31
 
from .scenarios import load_tests_apply_scenarios
 
19
import cStringIO
 
20
 
 
21
import bzrlib.bundle
 
22
from bzrlib.bundle.serializer import write_bundle
 
23
import bzrlib.bzrdir
 
24
import bzrlib.errors as errors
 
25
from bzrlib import tests
 
26
from bzrlib.tests.test_transport import TestTransportImplementation
 
27
from bzrlib.tests.per_transport import transport_test_permutations
 
28
import bzrlib.transport
 
29
import bzrlib.urlutils
 
30
from bzrlib.tests.scenarios import load_tests_apply_scenarios
32
31
 
33
32
 
34
33
load_tests = load_tests_apply_scenarios
37
36
def create_bundle_file(test_case):
38
37
    test_case.build_tree(['tree/', 'tree/a', 'tree/subdir/'])
39
38
 
40
 
    format = breezy.bzr.bzrdir.BzrDirFormat.get_default_format()
 
39
    format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
41
40
 
42
41
    bzrdir = format.initialize('tree')
43
42
    repo = bzrdir.create_repository()
44
 
    branch = repo.controldir.create_branch()
45
 
    wt = branch.controldir.create_workingtree()
 
43
    branch = repo.bzrdir.create_branch()
 
44
    wt = branch.bzrdir.create_workingtree()
46
45
 
47
46
    wt.add(['a', 'subdir/'])
48
 
    wt.commit('new project', rev_id=b'commit-1')
 
47
    wt.commit('new project', rev_id='commit-1')
49
48
 
50
 
    out = BytesIO()
 
49
    out = cStringIO.StringIO()
51
50
    rev_ids = write_bundle(wt.branch.repository,
52
51
                           wt.get_parent_ids()[0], 'null:', out)
53
52
    out.seek(0)
67
66
        # from the one we want to test, so we must inject a correct transport
68
67
        # into possible_transports first).
69
68
        self.possible_transports = [self.get_transport(self.bundle_name)]
70
 
        self.overrideEnv('BRZ_NO_SMART_VFS', None)
 
69
        self.overrideEnv('BZR_NO_SMART_VFS', None)
71
70
        wt = self.create_test_bundle()
72
71
 
73
72
    def read_mergeable_from_url(self, url):
74
 
        return breezy.bundle.read_mergeable_from_url(
 
73
        return bzrlib.bundle.read_mergeable_from_url(
75
74
            url, possible_transports=self.possible_transports)
76
75
 
77
76
    def get_url(self, relpath=''):
78
 
        return breezy.urlutils.join(self._server.get_url(), relpath)
 
77
        return bzrlib.urlutils.join(self._server.get_url(), relpath)
79
78
 
80
79
    def create_test_bundle(self):
81
80
        out, wt = create_bundle_file(self)
102
101
 
103
102
    def test_read_mergeable_respects_possible_transports(self):
104
103
        if not isinstance(self.get_transport(self.bundle_name),
105
 
                          breezy.transport.ConnectedTransport):
 
104
                          bzrlib.transport.ConnectedTransport):
106
105
            # There is no point testing transport reuse for not connected
107
106
            # transports (the test will fail even).
108
107
            raise tests.TestSkipped(