[PATCH 2 of 6 V3] tests: use print_function in test-batching.py

Robert Stanca robert.stanca7 at gmail.com
Sat Apr 2 23:52:21 EDT 2016


# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1459653052 -10800
#      Sun Apr 03 06:10:52 2016 +0300
# Node ID 23ce4bd614c6e48a872eeed3ae30fe3966faaae5
# Parent  6ca0155a8a0461aebd1ecee3ec5dc1647406c670
tests: use print_function in test-batching.py

diff -r 6ca0155a8a04 -r 23ce4bd614c6 tests/test-batching.py
--- a/tests/test-batching.py	Sun Apr 03 06:05:43 2016 +0300
+++ b/tests/test-batching.py	Sun Apr 03 06:10:52 2016 +0300
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 from mercurial.peer import (
     localbatch,
     batchable,
@@ -38,11 +38,11 @@
 def use(it):
 
     # Direct call to base method shared between client and server.
-    print it.hello()
+    print(it.hello())
 
     # Direct calls to proxied methods. They cause individual roundtrips.
-    print it.foo("Un", two="Deux")
-    print it.bar("Eins", "Zwei")
+    print(it.foo("Un", two="Deux"))
+    print(it.bar("Eins", "Zwei"))
 
     # Batched call to a couple of (possibly proxied) methods.
     batch = it.batch()
@@ -60,17 +60,17 @@
     # as possible.
     batch.submit()
     # After the call to submit, the futures actually contain values.
-    print foo.value
-    print foo2.value
-    print bar.value
-    print greet.value
-    print hello.value
-    print bar2.value
+    print(foo.value)
+    print(foo2.value)
+    print(bar.value)
+    print(greet.value)
+    print(hello.value)
+    print(bar2.value)
 
 # local usage
 mylocal = localthing()
-print
-print "== Local"
+print()
+print("== Local")
 use(mylocal)
 
 # demo remoting; mimicks what wireproto and HTTP/SSH do
@@ -100,12 +100,12 @@
         args = dict(arg.split('=', 1) for arg in args)
         return getattr(self, name)(**args)
     def perform(self, req):
-        print "REQ:", req
+        print("REQ:", req)
         name, args = req.split('?', 1)
         args = args.split('&')
         vals = dict(arg.split('=', 1) for arg in args)
         res = getattr(self, name)(**vals)
-        print "  ->", res
+        print("  ->", res)
         return res
     def batch(self, cmds):
         res = []
@@ -178,6 +178,6 @@
 # demo remote usage
 
 myproxy = remotething(myserver)
-print
-print "== Remote"
+print()
+print("== Remote")
 use(myproxy)
diff -r 6ca0155a8a04 -r 23ce4bd614c6 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sun Apr 03 06:05:43 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sun Apr 03 06:10:52 2016 +0300
@@ -53,7 +53,6 @@
   tests/svn-safe-append.py not using absolute_import
   tests/svnxml.py not using absolute_import
   tests/test-atomictempfile.py not using absolute_import
-  tests/test-batching.py requires print_function
   tests/test-bdiff.py not using absolute_import
   tests/test-bdiff.py requires print_function
   tests/test-context.py not using absolute_import
@@ -227,7 +226,6 @@
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
   tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/test-batching.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-bdiff.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-context.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)


More information about the Mercurial-devel mailing list