/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 breezy/tests/blackbox/test_pack.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-08 23:30:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170608233031-3qavls2o7a1pqllj
Update imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
 
21
21
from breezy import tests
 
22
from breezy.tests.matchers import ContainsNoVfsCalls
22
23
 
23
24
 
24
25
class TestPack(tests.TestCaseWithTransport):
27
28
        self._make_file(path, line_prefix, total_lines, versioned=True)
28
29
 
29
30
    def _make_file(self, path, line_prefix, total_lines, versioned):
30
 
        text = ''
 
31
        text=''
31
32
        for i in range(total_lines):
32
 
            text += line_prefix + str(i + 1) + "\n"
 
33
            text += line_prefix + str(i+1) + "\n"
33
34
 
34
35
        with open(path, 'w') as f:
35
36
            f.write(text)
70
71
        """Ensure --clean-obsolete-packs removes obsolete pack files
71
72
        """
72
73
        wt = self.make_branch_and_tree('.')
73
 
        t = wt.branch.repository.controldir.transport
 
74
        t = wt.branch.repository.bzrdir.transport
74
75
 
75
76
        # do multiple commits to ensure that obsolete packs are created
76
77
        # by 'brz pack'
82
83
 
83
84
        pack_names = t.list_dir('repository/obsolete_packs')
84
85
        self.assertTrue(len(pack_names) == 0)
 
86
 
 
87
 
 
88
class TestSmartServerPack(tests.TestCaseWithTransport):
 
89
 
 
90
    def test_simple_pack(self):
 
91
        self.setup_smart_server_with_call_log()
 
92
        t = self.make_branch_and_tree('branch')
 
93
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
94
        t.add("foo")
 
95
        t.commit("message")
 
96
        self.reset_smart_call_log()
 
97
        out, err = self.run_bzr(['pack', self.get_url('branch')])
 
98
        # This figure represent the amount of HPSS calls to perform this use
 
99
        # case. It is entirely ok to reduce this number if a test fails due to
 
100
        # rpc_count # being too low. If rpc_count increases, more network
 
101
        # roundtrips have become necessary for this use case. Please do not
 
102
        # adjust this number upwards without agreement from bzr's network
 
103
        # support maintainers.
 
104
        self.assertLength(6, self.hpss_calls)
 
105
        self.assertLength(1, self.hpss_connections)
 
106
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)