# HG changeset patch # User Robert Stanca # Date 1459609953 -10800 # Node ID f4b31fcd5e721aa0bc973196140927b7bc73193c # Parent 3cf1995dbdd59eb5b1fbedbc3d2fd8e147b7b30b py3: use print_function in get-with-headers.py diff -r 3cf1995dbdd5 -r f4b31fcd5e72 tests/get-with-headers.py --- a/tests/get-with-headers.py Sat Apr 02 17:36:59 2016 +0300 +++ b/tests/get-with-headers.py Sat Apr 02 18:12:33 2016 +0300 @@ -3,7 +3,7 @@ """This does HTTP GET requests given a host:port and path and returns a subset of the headers plus the body of the result.""" -from __future__ import absolute_import +from __future__ import absolute_import, print_function import httplib import json @@ -41,15 +41,15 @@ conn = httplib.HTTPConnection(host) conn.request("GET", '/' + path, None, headers) response = conn.getresponse() - print response.status, response.reason + print(response.status, response.reason) if show[:1] == ['-']: show = sorted(h for h, v in response.getheaders() if h.lower() not in show) for h in [h.lower() for h in show]: if response.getheader(h, None) is not None: - print "%s: %s" % (h, response.getheader(h)) + print("%s: %s" % (h, response.getheader(h))) if not headeronly: - print + print() data = response.read() # Pretty print JSON. This also has the beneficial side-effect @@ -60,7 +60,7 @@ data = json.loads(data) lines = json.dumps(data, sort_keys=True, indent=2).splitlines() for line in lines: - print line.rstrip() + print(line.rstrip()) else: sys.stdout.write(data) diff -r 3cf1995dbdd5 -r f4b31fcd5e72 tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t Sat Apr 02 17:36:59 2016 +0300 +++ b/tests/test-check-py3-compat.t Sat Apr 02 18:12:33 2016 +0300 @@ -40,7 +40,6 @@ i18n/check-translation.py not using absolute_import i18n/polib.py not using absolute_import setup.py not using absolute_import - tests/get-with-headers.py requires print_function tests/heredoctest.py requires print_function tests/hypothesishelpers.py not using absolute_import tests/hypothesishelpers.py requires print_function @@ -257,7 +256,6 @@ mercurial/win*.py: error importing module: No module named 'msvcrt' (line *) (glob) mercurial/windows.py: error importing module: No module named '_winreg' (line *) (glob) mercurial/wireproto.py: error importing module: invalid syntax (bundle*.py, line *) (line *) (glob) - tests/get-with-headers.py: invalid syntax: Missing parentheses in call to 'print' (, line *) (glob) tests/readlink.py: invalid syntax: invalid syntax (, line *) (glob) tests/silenttestrunner.py: invalid syntax: Missing parentheses in call to 'print' (, line *) (glob) tests/test-batching.py: invalid syntax: invalid syntax (, line *) (glob)