/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-08-21 09:32:52 UTC
  • mfrom: (7065.3.15 python-bundle)
  • Revision ID: breezy.the.bot@gmail.com-20180821093252-dhir83sygqwzbv77
Fix some bundle-related tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python-bundle/+merge/353123

Show diffs side-by-side

added added

removed removed

Lines of Context:
1943
1943
 
1944
1944
        # GZ 2010-06-07: Note we can't actually grep for \u1234 as the pattern
1945
1945
        #                is mangled according to the user encoding.
1946
 
        streams = self.run_bzr(["grep", "--files-with-matches",
 
1946
        streams = self.run_bzr_raw(["grep", "--files-with-matches",
1947
1947
            u"contents"], encoding="UTF-8")
1948
 
        if not PY3:
1949
 
            as_utf8 = as_utf8.encode("UTF-8")
1950
 
        self.assertEqual(streams, (as_utf8 + "\n", ""))
 
1948
        as_utf8 = as_utf8.encode("UTF-8")
 
1949
        self.assertEqual(streams, (as_utf8 + b"\n", b""))
1951
1950
 
1952
 
        streams = self.run_bzr(["grep", "-r", "1", "--files-with-matches",
 
1951
        streams = self.run_bzr_raw(["grep", "-r", "1", "--files-with-matches",
1953
1952
            u"contents"], encoding="UTF-8")
1954
 
        self.assertEqual(streams, (as_utf8 + "~1\n", ""))
 
1953
        self.assertEqual(streams, (as_utf8 + b"~1\n", b""))
1955
1954
 
1956
1955
        fileencoding = osutils.get_user_encoding()
1957
1956
        as_mangled = as_utf8.decode(fileencoding, "replace").encode("UTF-8")
1958
1957
 
1959
 
        streams = self.run_bzr(["grep", "-n",
 
1958
        streams = self.run_bzr_raw(["grep", "-n",
1960
1959
            u"contents"], encoding="UTF-8")
1961
 
        self.assertEqual(streams, ("%s:1:contents of %s\n" %
1962
 
            (as_utf8, as_mangled), ""))
 
1960
        self.assertEqual(streams, (b"%s:1:contents of %s\n" %
 
1961
            (as_utf8, as_mangled), b""))
1963
1962
 
1964
 
        streams = self.run_bzr(["grep", "-n", "-r", "1",
 
1963
        streams = self.run_bzr_raw(["grep", "-n", "-r", "1",
1965
1964
            u"contents"], encoding="UTF-8")
1966
 
        self.assertEqual(streams, ("%s~1:1:contents of %s\n" %
1967
 
            (as_utf8, as_mangled), ""))
 
1965
        self.assertEqual(streams, (b"%s~1:1:contents of %s\n" %
 
1966
            (as_utf8, as_mangled), b""))
1968
1967
 
1969
1968
 
1970
1969
class TestColorGrep(GrepTestBase):