/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_revert.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-17 11:15:04 UTC
  • mto: (6973.12.2 python3-k)
  • mto: This revision was merged to the branch mainline in revision 7003.
  • Revision ID: jelmer@jelmer.uk-20180617111504-i2eqvqbtfj5bp0t3
s/file/open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
        self.run_bzr('init')
31
31
        self.run_bzr('mkdir dir')
32
32
 
33
 
        f = file('dir/file', 'wb')
34
 
        f.write('spam')
35
 
        f.close()
 
33
        with open('dir/file', 'wb') as f:
 
34
            f.write(b'spam')
36
35
        self.run_bzr('add dir/file')
37
36
 
38
37
        self.run_bzr('commit -m1')
39
38
 
40
39
        # modify file
41
 
        f = file('dir/file', 'wb')
42
 
        f.write('eggs')
43
 
        f.close()
 
40
        with open('dir/file', 'wb') as f:
 
41
            f.write(b'eggs')
44
42
 
45
43
        # check status
46
44
        self.assertEqual('modified:\n  dir/file\n', self.run_bzr('status')[0])
120
118
    def test_revert(self):
121
119
        self.run_bzr('init')
122
120
 
123
 
        with file('hello', 'wt') as f: f.write('foo')
 
121
        with open('hello', 'wt') as f: f.write('foo')
124
122
        self.run_bzr('add hello')
125
123
        self.run_bzr('commit -m setup hello')
126
124
 
127
 
        with file('goodbye', 'wt') as f: f.write('baz')
 
125
        with open('goodbye', 'wt') as f: f.write('baz')
128
126
        self.run_bzr('add goodbye')
129
127
        self.run_bzr('commit -m setup goodbye')
130
128
 
131
 
        with file('hello', 'wt') as f: f.write('bar')
132
 
        with file('goodbye', 'wt') as f: f.write('qux')
 
129
        with open('hello', 'wt') as f: f.write('bar')
 
130
        with open('goodbye', 'wt') as f: f.write('qux')
133
131
        self.run_bzr('revert hello')
134
132
        self.check_file_contents('hello', 'foo')
135
133
        self.check_file_contents('goodbye', 'qux')
157
155
        else:
158
156
            self.log("skipping revert symlink tests")
159
157
 
160
 
        with file('hello', 'wt') as f: f.write('xyz')
 
158
        with open('hello', 'wt') as f: f.write('xyz')
161
159
        self.run_bzr('commit -m xyz hello')
162
160
        self.run_bzr('revert -r 1 hello')
163
161
        self.check_file_contents('hello', 'foo')