/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/grep/test_grep.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-06-30 23:11:39 UTC
  • mfrom: (6973.12.13 python3-k)
  • Revision ID: breezy.the.bot@gmail.com-20180630231139-tf5t5khh6bu5ntpm
Fix some more tests on python3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-k/+merge/348646

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        for i in range(total_lines):
46
46
            text += line_prefix + str(i+1) + "\n"
47
47
 
48
 
        open(path, 'w').write(text)
 
48
        with open(path, 'w') as f:
 
49
            f.write(text)
49
50
        if versioned:
50
51
            self.run_bzr(['add', path])
51
52
            self.run_bzr(['ci', '-m', '"' + path + '"'])
52
53
 
53
54
    def _update_file(self, path, text, checkin=True):
54
55
        """append text to file 'path' and check it in"""
55
 
        open(path, 'a').write(text)
 
56
        with open(path, 'a') as f:
 
57
            f.write(text)
56
58
        if checkin:
57
59
            self.run_bzr(['ci', path, '-m', '"' + path + '"'])
58
60
 
2205
2207
        self.build_tree_contents([('blah', b'hello world!2\n')]) # rev 4
2206
2208
        tree.add('blah')
2207
2209
        tree.commit('rev4')
2208
 
        open('hello', 'a').write('hello world!3\n')
 
2210
        with open('hello', 'a') as f:
 
2211
            f.write('hello world!3\n')
2209
2212
        #self.build_tree_contents([('hello', 'hello world!3\n')]) # rev 5
2210
2213
        tree.commit('rev5')
2211
2214
        out, err = self.run_bzr(['grep', '-p', '-r', '2..5', 'hello'])