# HG changeset patch # User Augie Fackler # Date 2017-06-15 17:32:32 # Node ID 27fb986e54d0ce61179f78a13e762b7c5757442d # Parent 388901a15bfa8f606612430a52f79097693d16b5 tests: fix simple heredoc print statements to work on Py3 There are a handful left that require some more care. Differential Revision: https://phab.mercurial-scm.org/D293 diff --git a/tests/test-hgweb-no-path-info.t b/tests/test-hgweb-no-path-info.t --- a/tests/test-hgweb-no-path-info.t +++ b/tests/test-hgweb-no-path-info.t @@ -31,11 +31,11 @@ should be used from d74fc8dec2b4 onward > input = stringio() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' + > print('---- STATUS') + > print(status) + > print('---- HEADERS') + > print([i for i in headers if i[0] != 'ETag']) + > print('---- DATA') > return output.write > > env = { @@ -59,8 +59,8 @@ should be used from d74fc8dec2b4 onward > sys.stdout.write(output.getvalue()) > sys.stdout.write(''.join(content)) > getattr(content, 'close', lambda : None)() - > print '---- ERRORS' - > print errors.getvalue() + > print('---- ERRORS') + > print(errors.getvalue()) > > output = stringio() > env['QUERY_STRING'] = 'style=atom' diff --git a/tests/test-hgweb-no-request-uri.t b/tests/test-hgweb-no-request-uri.t --- a/tests/test-hgweb-no-request-uri.t +++ b/tests/test-hgweb-no-request-uri.t @@ -31,11 +31,11 @@ should be used from d74fc8dec2b4 onward > input = stringio() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' + > print('---- STATUS') + > print(status) + > print('---- HEADERS') + > print([i for i in headers if i[0] != 'ETag']) + > print('---- DATA') > return output.write > > env = { @@ -58,8 +58,8 @@ should be used from d74fc8dec2b4 onward > sys.stdout.write(output.getvalue()) > sys.stdout.write(''.join(content)) > getattr(content, 'close', lambda : None)() - > print '---- ERRORS' - > print errors.getvalue() + > print('---- ERRORS') + > print(errors.getvalue()) > > output = stringio() > env['PATH_INFO'] = '/' diff --git a/tests/test-hgweb-non-interactive.t b/tests/test-hgweb-non-interactive.t --- a/tests/test-hgweb-non-interactive.t +++ b/tests/test-hgweb-non-interactive.t @@ -41,11 +41,11 @@ by the WSGI standard and strictly implem > output = stringio() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' + > print('---- STATUS') + > print(status) + > print('---- HEADERS') + > print([i for i in headers if i[0] != 'ETag']) + > print('---- DATA') > return output.write > > env = { @@ -68,13 +68,13 @@ by the WSGI standard and strictly implem > i = hgweb('.') > for c in i(env, startrsp): > pass - > print '---- ERRORS' - > print errors.getvalue() - > print '---- OS.ENVIRON wsgi variables' - > print sorted([x for x in os.environ if x.startswith('wsgi')]) - > print '---- request.ENVIRON wsgi variables' + > print('---- ERRORS') + > print(errors.getvalue()) + > print('---- OS.ENVIRON wsgi variables') + > print(sorted([x for x in os.environ if x.startswith('wsgi')])) + > print('---- request.ENVIRON wsgi variables') > with i._obtainrepo() as repo: - > print sorted([x for x in repo.ui.environ if x.startswith('wsgi')]) + > print(sorted([x for x in repo.ui.environ if x.startswith('wsgi')])) > EOF $ $PYTHON request.py ---- STATUS diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t --- a/tests/test-repair-strip.t +++ b/tests/test-repair-strip.t @@ -4,7 +4,7 @@ > import sys > for entry in sys.stdin.read().split('\n'): > if entry: - > print entry.split('\x00')[0] + > print(entry.split('\x00')[0]) > EOF $ echo "[extensions]" >> $HGRCPATH