<div dir="ltr"><div># HG changeset patch<br># User Robert Stanca <<a href="mailto:robert.stanca7@gmail.com">robert.stanca7@gmail.com</a>><br># Date 1458883639 -7200<br>#      Fri Mar 25 07:27:19 2016 +0200<br># Node ID 537c362a11af6ddaf33299c0585e94a0235ac6bb<br># Parent  b4ded5849c3e6a571a1a5aa47f93f9f78e424f6d<br>multiple: use absolute_import , print_function<br><br>diff -r b4ded5849c3e -r 537c362a11af tests/filterpyflakes.py<br>--- a/tests/filterpyflakes.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/filterpyflakes.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -2,7 +2,7 @@<br> <br> # Filter output by pyflakes to control which warnings we check<br> <br>-from __future__ import absolute_import<br>+from __future__ import absolute_import, print_function<br> <br> import re<br> import sys<br>@@ -54,8 +54,8 @@<br> <br> for msgtype, line in sorted(lines, key=makekey):<br>     sys.stdout.write(line)<br>-print<br>+print()<br> <br> # self test of "undefined name" detection for other than 'memoryview'<br> if False:<br>-    print undefinedname<br>+    print (undefinedname)<br>diff -r b4ded5849c3e -r 537c362a11af tests/generate-working-copy-states.py<br>--- a/tests/generate-working-copy-states.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/generate-working-copy-states.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -29,7 +29,7 @@<br> # $ hg forget *_*_*-untracked<br> # $ rm *_*_missing-*<br> <br>-from __future__ import absolute_import<br>+from __future__ import absolute_import, print_function<br> <br> import os<br> import sys<br>@@ -66,7 +66,7 @@<br> content = []<br> for filename, states in combinations:<br>     if target == 'filelist':<br>-        print filename<br>+        print (filename)<br>     elif target == 'state':<br>         if depth == 'wc':<br>             # Make sure there is content so the file gets written and can be<br>@@ -75,7 +75,7 @@<br>         else:<br>             content.append((filename, states[int(depth) - 1]))<br>     else:<br>-        print >> sys.stderr, "unknown target:", target<br>+        print ("unknown target:", target, file=stderr)<br>         sys.exit(1)<br> <br> # write actual content<br>diff -r b4ded5849c3e -r 537c362a11af tests/get-with-headers.py<br>--- a/tests/get-with-headers.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/get-with-headers.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -3,7 +3,7 @@<br> """This does HTTP GET requests given a host:port and path and returns<br> a subset of the headers plus the body of the result."""<br> <br>-from __future__ import absolute_import<br>+from __future__ import absolute_import, print_function<br> <br> import httplib<br> import json<br>@@ -41,15 +41,15 @@<br>     conn = httplib.HTTPConnection(host)<br>     conn.request("GET", '/' + path, None, headers)<br>     response = conn.getresponse()<br>-    print response.status, response.reason<br>+    print (response.status, response.reason)<br>     if show[:1] == ['-']:<br>         show = sorted(h for h, v in response.getheaders()<br>                       if h.lower() not in show)<br>     for h in [h.lower() for h in show]:<br>         if response.getheader(h, None) is not None:<br>-            print "%s: %s" % (h, response.getheader(h))<br>+            print ("%s: %s" % (h, response.getheader(h)))<br>     if not headeronly:<br>-        print<br>+        print()<br>         data = response.read()<br> <br>         # Pretty print JSON. This also has the beneficial side-effect<br>@@ -60,7 +60,7 @@<br>             data = json.loads(data)<br>             lines = json.dumps(data, sort_keys=True, indent=2).splitlines()<br>             for line in lines:<br>-                print line.rstrip()<br>+                print (line.rstrip())<br>         else:<br>             sys.stdout.write(data)<br> <br>diff -r b4ded5849c3e -r 537c362a11af tests/heredoctest.py<br>--- a/tests/heredoctest.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/heredoctest.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -1,4 +1,4 @@<br>-from __future__ import absolute_import<br>+from __future__ import absolute_import, print_function<br> <br> import sys<br> <br>diff -r b4ded5849c3e -r 537c362a11af tests/hypothesishelpers.py<br>--- a/tests/hypothesishelpers.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/hypothesishelpers.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -4,6 +4,7 @@<br> #<br> # For details see <a href="http://hypothesis.readthedocs.org">http://hypothesis.readthedocs.org</a><br> <br>+from __future__ import absolute_import, print_function<br> import os<br> import sys<br> import traceback<br>diff -r b4ded5849c3e -r 537c362a11af tests/silenttestrunner.py<br>--- a/tests/silenttestrunner.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/silenttestrunner.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -1,4 +1,8 @@<br>-import unittest, sys, os<br>+from __future__ import absolute_import, print_function<br>+<br>+import unittest<br>+import sys<br>+import os<br> <br> def main(modulename):<br>     '''run the tests found in module, printing nothing when all tests pass'''<br>@@ -8,12 +12,12 @@<br>     suite.run(results)<br>     if results.errors or results.failures:<br>         for tc, exc in results.errors:<br>-            print 'ERROR:', tc<br>-            print<br>+            print ('ERROR:', tc)<br>+            print()<br>             sys.stdout.write(exc)<br>         for tc, exc in results.failures:<br>-            print 'FAIL:', tc<br>-            print<br>+            print ('FAIL:', tc)<br>+            print()<br>             sys.stdout.write(exc)<br>         sys.exit(1)<br> <br>diff -r b4ded5849c3e -r 537c362a11af tests/test-bdiff.py<br>--- a/tests/test-bdiff.py    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/test-bdiff.py    Fri Mar 25 07:27:19 2016 +0200<br>@@ -1,5 +1,9 @@<br>+from __future__ import absolute_import, print_function<br> import struct<br>-from mercurial import bdiff, mpatch<br>+from mercurial import (<br>+    bdiff, <br>+    mpatch,<br>+)<br> <br> def test1(a, b):<br>     d = bdiff.bdiff(a, b)<br>@@ -7,13 +11,13 @@<br>     if d:<br>         c = mpatch.patches(a, [d])<br>     if c != b:<br>-        print "***", repr(a), repr(b)<br>-        print "bad:"<br>-        print repr(c)[:200]<br>-        print repr(d)<br>+        print ("***", repr(a), repr(b))<br>+        print ("bad:")<br>+        print (repr(c)[:200])<br>+        print (repr(d))<br> <br> def test(a, b):<br>-    print "***", repr(a), repr(b)<br>+    print ("***", repr(a), repr(b))<br>     test1(a, b)<br>     test1(b, a)<br> <br>@@ -44,23 +48,23 @@<br>     while pos < len(bin):<br>         p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])<br>         pos += 12<br>-        print p1, p2, repr(bin[pos:pos + l])<br>+        print (p1, p2, repr(bin[pos:pos + l]))<br>         pos += l<br> showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")<br> showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n")<br> <br>-print "done"<br>+print ("done")<br> <br> def testfixws(a, b, allws):<br>     c = bdiff.fixws(a, allws)<br>     if c != b:<br>-        print "*** fixws", repr(a), repr(b), allws<br>-        print "got:"<br>-        print repr(c)<br>+        print ("*** fixws", repr(a), repr(b), allws)<br>+        print ("got:")<br>+        print (repr(c))<br> <br> testfixws(" \ta\r b\t\n", "ab\n", 1)<br> testfixws(" \ta\r b\t\n", " a b\n", 0)<br> testfixws("", "", 1)<br> testfixws("", "", 0)<br> <br>-print "done"<br>+print ("done")<br>diff -r b4ded5849c3e -r 537c362a11af tests/test-check-py3-compat.t<br>--- a/tests/test-check-py3-compat.t    Fri Mar 25 07:08:34 2016 +0200<br>+++ b/tests/test-check-py3-compat.t    Fri Mar 25 07:27:19 2016 +0200<br>@@ -42,28 +42,18 @@<br>   i18n/check-translation.py not using absolute_import<br>   i18n/polib.py not using absolute_import<br>   setup.py not using absolute_import<br>-  tests/filterpyflakes.py requires print_function<br>-  tests/generate-working-copy-states.py requires print_function<br>-  tests/get-with-headers.py requires print_function<br>-  tests/heredoctest.py requires print_function<br>-  tests/hypothesishelpers.py not using absolute_import<br>-  tests/hypothesishelpers.py requires print_function<br>   tests/killdaemons.py not using absolute_import<br>   tests/md5sum.py not using absolute_import<br>   tests/mockblackbox.py not using absolute_import<br>   tests/printenv.py not using absolute_import<br>   tests/revlog-formatv0.py not using absolute_import<br>   tests/run-tests.py not using absolute_import<br>-  tests/silenttestrunner.py not using absolute_import<br>-  tests/silenttestrunner.py requires print_function<br>   tests/sitecustomize.py not using absolute_import<br>   tests/svn-safe-append.py not using absolute_import<br>   tests/svnxml.py not using absolute_import<br>   tests/test-atomictempfile.py not using absolute_import<br>   tests/test-batching.py not using absolute_import<br>   tests/test-batching.py requires print_function<br>-  tests/test-bdiff.py not using absolute_import<br>-  tests/test-bdiff.py requires print_function<br>   tests/test-context.py not using absolute_import<br>   tests/test-context.py requires print_function<br>   tests/test-demandimport.py not using absolute_import<br><br><br></div>these patches are exported from a revision with previos patches posted here, hope  it's not o problem to merge<br></div>