~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_pack.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-16 19:18:39 UTC
  • mto: This revision was merged to the branch mainline in revision 6391.
  • Revision ID: jelmer@samba.org-20111216191839-eg681lxqibi1qxu1
Fix remaining tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
 
21
21
from bzrlib import tests
 
22
from bzrlib.tests.matchers import ContainsNoVfsCalls
22
23
 
23
24
 
24
25
class TestPack(tests.TestCaseWithTransport):
38
39
 
39
40
    def _update_file(self, path, text, checkin=True):
40
41
        """append text to file 'path' and check it in"""
41
 
        open(path, 'a').write(text)
 
42
        with open(path, 'a') as f:
 
43
            f.write(text)
 
44
 
42
45
        if checkin:
43
46
            self.run_bzr(['ci', path, '-m', '"' + path + '"'])
44
47
 
81
84
 
82
85
        pack_names = transport.list_dir('repository/obsolete_packs')
83
86
        self.assertTrue(len(pack_names) == 0)
 
87
 
 
88
 
 
89
class TestSmartServerPack(tests.TestCaseWithTransport):
 
90
 
 
91
    def test_simple_pack(self):
 
92
        self.setup_smart_server_with_call_log()
 
93
        t = self.make_branch_and_tree('branch')
 
94
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
95
        t.add("foo")
 
96
        t.commit("message")
 
97
        self.reset_smart_call_log()
 
98
        out, err = self.run_bzr(['pack', self.get_url('branch')])
 
99
        # This figure represent the amount of HPSS calls to perform this use
 
100
        # case. It is entirely ok to reduce this number if a test fails due to
 
101
        # rpc_count # being too low. If rpc_count increases, more network
 
102
        # roundtrips have become necessary for this use case. Please do not
 
103
        # adjust this number upwards without agreement from bzr's network
 
104
        # support maintainers.
 
105
        self.assertLength(6, self.hpss_calls)
 
106
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)