~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_basis_inventory.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2008 Canonical Ltd
 
1
# Copyright (C) 2005-2009, 2011, 2012, 2016 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
import os
18
 
 
19
17
from bzrlib.tests import TestNotApplicable
20
18
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
21
 
from bzrlib.branch import Branch
22
 
from bzrlib import inventory
23
 
from bzrlib.revision import Revision
24
19
import bzrlib.xml6
25
20
 
26
21
 
39
34
        # Make sure the basis file is created by a commit
40
35
        t = self.make_branch_and_tree('.')
41
36
        b = t.branch
42
 
        open('a', 'wb').write('a\n')
 
37
        with open('a', 'wb') as f: f.write('a\n')
43
38
        t.add('a')
44
39
        t.commit('a', rev_id='r1')
45
40
 
46
41
        self.assertTrue(t._transport.has('basis-inventory-cache'))
47
42
 
48
 
        basis_inv = t.basis_tree().inventory
49
 
        self.assertEquals('r1', basis_inv.revision_id)
 
43
        basis_inv = t.basis_tree().root_inventory
 
44
        self.assertEqual('r1', basis_inv.revision_id)
50
45
 
51
46
        store_inv = b.repository.get_inventory('r1')
52
47
        self.assertEqual([], store_inv._make_delta(basis_inv))
53
48
 
54
 
        open('b', 'wb').write('b\n')
 
49
        with open('b', 'wb') as f: f.write('b\n')
55
50
        t.add('b')
56
51
        t.commit('b', rev_id='r2')
57
52
 
59
54
 
60
55
        basis_inv_txt = t.read_basis_inventory()
61
56
        basis_inv = bzrlib.xml7.serializer_v7.read_inventory_from_string(basis_inv_txt)
62
 
        self.assertEquals('r2', basis_inv.revision_id)
 
57
        self.assertEqual('r2', basis_inv.revision_id)
63
58
        store_inv = b.repository.get_inventory('r2')
64
59
 
65
60
        self.assertEqual([], store_inv._make_delta(basis_inv))
74
69
                % (self.workingtree_format,))
75
70
        t = self.make_branch_and_tree('.')
76
71
        b = t.branch
77
 
        open('a', 'wb').write('a\n')
 
72
        with open('a', 'wb') as f: f.write('a\n')
78
73
        t.add('a')
79
74
        t.commit('a', rev_id='r1')
80
75
        t._transport.put_bytes('basis-inventory-cache', 'booga')