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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 contextlib
 
18
from io import BytesIO
17
19
import os
18
20
import re
19
21
import subprocess
21
23
import tempfile
22
24
 
23
25
from .. import (
24
 
    cleanup,
25
26
    diff,
26
27
    errors,
27
28
    osutils,
30
31
    revisiontree,
31
32
    tests,
32
33
    )
33
 
from ..sixish import (
34
 
    BytesIO,
35
 
    unichr,
36
 
    )
37
34
from ..tests import (
38
35
    features,
39
36
    EncodingAdapter,
608
605
            [('tree/' + alpha, b'\0'),
609
606
             ('tree/' + omega,
610
607
              (b'The %s and the %s\n' % (alpha_utf8, omega_utf8)))])
611
 
        tree.add([alpha], [b'file-id'])
612
 
        tree.add([omega], [b'file-id-2'])
 
608
        tree.add([alpha])
 
609
        tree.add([omega])
613
610
        diff_content = StubO()
614
611
        diff.show_diff_trees(tree.basis_tree(), tree, diff_content)
615
612
        diff_content.check_types(self, bytes)
805
802
        self.differ.diff('olddir/oldfile', 'newdir/newfile')
806
803
        self.assertContainsRe(
807
804
            self.differ.to_file.getvalue(),
808
 
            br'--- olddir/oldfile.*\n\+\+\+ newdir/newfile.*\n\@\@ -1,1 \+0,0'
809
 
            br' \@\@\n-old\n\n')
 
805
            br'--- olddir/oldfile.*\n'
 
806
            br'\+\+\+ newdir/newfile.*\n'
 
807
            br'\@\@ -1,1 \+0,0 \@\@\n'
 
808
            br'-old\n'
 
809
            br'\n')
810
810
        self.assertContainsRe(self.differ.to_file.getvalue(),
811
811
                              b"=== target is 'new'\n")
812
812
 
1031
1031
 
1032
1032
    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
1033
1033
        """Call get_trees_and_branches_to_diff_locked."""
1034
 
        exit_stack = cleanup.ExitStack()
 
1034
        exit_stack = contextlib.ExitStack()
1035
1035
        self.addCleanup(exit_stack.close)
1036
1036
        return diff.get_trees_and_branches_to_diff_locked(
1037
1037
            path_list, revision_specs, old_url, new_url, exit_stack)