[PATCH 5 of 6 V2] tests: use print_function in test-filecache.py

Robert Stanca robert.stanca7 at gmail.com
Sun Apr 3 10:30:34 EDT 2016


# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1459692400 -10800
#      Sun Apr 03 17:06:40 2016 +0300
# Node ID db75c2efc5bf483c91a266930ca5e4d12d29b223
# Parent  72c1dca0584caf8e18d88fa132dbc889c053f32c
tests: use print_function in test-filecache.py

diff -r 72c1dca0584c -r db75c2efc5bf tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sun Apr 03 17:01:07 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sun Apr 03 17:06:40 2016 +0300
@@ -56,7 +56,6 @@
   tests/test-demandimport.py not using absolute_import
   tests/test-demandimport.py requires print_function
   tests/test-doctest.py not using absolute_import
-  tests/test-filecache.py requires print_function
   tests/test-filelog.py not using absolute_import
   tests/test-filelog.py requires print_function
   tests/test-hg-parseurl.py not using absolute_import
@@ -220,7 +219,6 @@
   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-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/test-filecache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/test-filelog.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/test-hg-parseurl.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-hgweb-auth.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
diff -r 72c1dca0584c -r db75c2efc5bf tests/test-filecache.py
--- a/tests/test-filecache.py	Sun Apr 03 17:01:07 2016 +0300
+++ b/tests/test-filecache.py	Sun Apr 03 17:06:40 2016 +0300
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 import os
 import subprocess
 import sys
@@ -23,7 +23,7 @@
 
     @filecache('x', 'y')
     def cached(self):
-        print 'creating'
+        print('creating')
         return 'string from function'
 
     def invalidate(self):
@@ -34,12 +34,12 @@
                 pass
 
 def basic(repo):
-    print "* neither file exists"
+    print("* neither file exists")
     # calls function
     repo.cached
 
     repo.invalidate()
-    print "* neither file still exists"
+    print("* neither file still exists")
     # uses cache
     repo.cached
 
@@ -47,7 +47,7 @@
     f = open('x', 'w')
     f.close()
     repo.invalidate()
-    print "* empty file x created"
+    print("* empty file x created")
     # should recreate the object
     repo.cached
 
@@ -55,12 +55,12 @@
     f.write('a')
     f.close()
     repo.invalidate()
-    print "* file x changed size"
+    print("* file x changed size")
     # should recreate the object
     repo.cached
 
     repo.invalidate()
-    print "* nothing changed with either file"
+    print("* nothing changed with either file")
     # stats file again, reuses object
     repo.cached
 
@@ -72,14 +72,14 @@
     f.close()
 
     repo.invalidate()
-    print "* file x changed inode"
+    print("* file x changed inode")
     repo.cached
 
     # create empty file y
     f = open('y', 'w')
     f.close()
     repo.invalidate()
-    print "* empty file y created"
+    print("* empty file y created")
     # should recreate the object
     repo.cached
 
@@ -87,7 +87,7 @@
     f.write('A')
     f.close()
     repo.invalidate()
-    print "* file y changed size"
+    print("* file y changed size")
     # should recreate the object
     repo.cached
 
@@ -96,7 +96,7 @@
     f.close()
 
     repo.invalidate()
-    print "* file y changed inode"
+    print("* file y changed inode")
     repo.cached
 
     f = scmutil.opener('.')('x', 'w', atomictemp=True)
@@ -107,7 +107,7 @@
     f.close()
 
     repo.invalidate()
-    print "* both files changed inode"
+    print("* both files changed inode")
     repo.cached
 
 def fakeuncacheable():
@@ -152,36 +152,36 @@
     os.remove('y')
     repo.cached = 'string set externally'
     repo.invalidate()
-    print "* neither file exists"
-    print repo.cached
+    print("* neither file exists")
+    print(repo.cached)
     repo.invalidate()
     f = open('x', 'w')
     f.write('a')
     f.close()
-    print "* file x created"
-    print repo.cached
+    print("* file x created")
+    print(repo.cached)
 
     repo.cached = 'string 2 set externally'
     repo.invalidate()
-    print "* string set externally again"
-    print repo.cached
+    print("* string set externally again")
+    print(repo.cached)
 
     repo.invalidate()
     f = open('y', 'w')
     f.write('b')
     f.close()
-    print "* file y created"
-    print repo.cached
+    print("* file y created")
+    print(repo.cached)
 
-print 'basic:'
-print
+print('basic:')
+print()
 basic(fakerepo())
-print
-print 'fakeuncacheable:'
-print
+print()
+print('fakeuncacheable:')
+print()
 fakeuncacheable()
 test_filecache_synced()
-print
-print 'setbeforeget:'
-print
+print()
+print('setbeforeget:')
+print()
 setbeforeget(fakerepo())


More information about the Mercurial-devel mailing list