/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/plugins/weave_fmt/test_workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 19:18:40 UTC
  • mto: This revision was merged to the branch mainline in revision 6928.
  • Revision ID: jelmer@jelmer.uk-20180218191840-2wezg20u9ffbfmed
Fix more bees, use with rather than try/finally for some files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        tree = self.create_format2_tree('.')
46
46
        self.assertRaises(errors.UnsupportedOperation, tree.set_conflicts,
47
47
                          None)
48
 
        file('lala.BASE', 'wb').write('labase')
 
48
        with open('lala.BASE', 'wb') as f:
 
49
            f.write(b'labase')
49
50
        expected = conflicts.ContentsConflict('lala')
50
51
        self.assertEqual(list(tree.conflicts()), [expected])
51
 
        file('lala', 'wb').write('la')
 
52
        with open('lala', 'wb') as f:
 
53
            f.write(b'la')
52
54
        tree.add('lala', b'lala-id')
53
55
        expected = conflicts.ContentsConflict('lala', file_id='lala-id')
54
56
        self.assertEqual(list(tree.conflicts()), [expected])
55
 
        file('lala.THIS', 'wb').write('lathis')
56
 
        file('lala.OTHER', 'wb').write('laother')
 
57
        with open('lala.THIS', 'wb') as f:
 
58
            f.write(b'lathis')
 
59
        with open('lala.OTHER', 'wb') as f:
 
60
            f.write(b'laother')
57
61
        # When "text conflict"s happen, stem, THIS and OTHER are text
58
62
        expected = conflicts.TextConflict('lala', file_id='lala-id')
59
63
        self.assertEqual(list(tree.conflicts()), [expected])
82
86
        conflicts.restore('hello')
83
87
        conflicts.restore('hello.sploo')
84
88
        self.assertLength(0, tree.conflicts())
85
 
        self.assertFileEqual('hello world2', 'hello')
 
89
        self.assertFileEqual('hello world2', b'hello')
86
90
        self.assertFalse(os.path.lexists('hello.sploo'))
87
91
        self.assertRaises(errors.NotConflicted, conflicts.restore, 'hello')
88
92
        self.assertRaises(errors.NotConflicted,