##// END OF EJS Templates
py3: use print_function in test-filecache.py
Robert Stanca -
r28742:a08c90d6 default
parent child Browse files
Show More
@@ -56,7 +56,6 b''
56 56 tests/test-demandimport.py not using absolute_import
57 57 tests/test-demandimport.py requires print_function
58 58 tests/test-doctest.py not using absolute_import
59 tests/test-filecache.py requires print_function
60 59 tests/test-filelog.py not using absolute_import
61 60 tests/test-filelog.py requires print_function
62 61 tests/test-hg-parseurl.py not using absolute_import
@@ -245,7 +244,6 b''
245 244 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
246 245 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
247 246 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
248 tests/test-filecache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
249 247 tests/test-filelog.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
250 248 tests/test-hg-parseurl.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
251 249 tests/test-hgweb-auth.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
@@ -1,4 +1,4 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import, print_function
2 2 import os
3 3 import subprocess
4 4 import sys
@@ -23,7 +23,7 b' class fakerepo(object):'
23 23
24 24 @filecache('x', 'y')
25 25 def cached(self):
26 print 'creating'
26 print('creating')
27 27 return 'string from function'
28 28
29 29 def invalidate(self):
@@ -34,12 +34,12 b' class fakerepo(object):'
34 34 pass
35 35
36 36 def basic(repo):
37 print "* neither file exists"
37 print("* neither file exists")
38 38 # calls function
39 39 repo.cached
40 40
41 41 repo.invalidate()
42 print "* neither file still exists"
42 print("* neither file still exists")
43 43 # uses cache
44 44 repo.cached
45 45
@@ -47,7 +47,7 b' def basic(repo):'
47 47 f = open('x', 'w')
48 48 f.close()
49 49 repo.invalidate()
50 print "* empty file x created"
50 print("* empty file x created")
51 51 # should recreate the object
52 52 repo.cached
53 53
@@ -55,12 +55,12 b' def basic(repo):'
55 55 f.write('a')
56 56 f.close()
57 57 repo.invalidate()
58 print "* file x changed size"
58 print("* file x changed size")
59 59 # should recreate the object
60 60 repo.cached
61 61
62 62 repo.invalidate()
63 print "* nothing changed with either file"
63 print("* nothing changed with either file")
64 64 # stats file again, reuses object
65 65 repo.cached
66 66
@@ -72,14 +72,14 b' def basic(repo):'
72 72 f.close()
73 73
74 74 repo.invalidate()
75 print "* file x changed inode"
75 print("* file x changed inode")
76 76 repo.cached
77 77
78 78 # create empty file y
79 79 f = open('y', 'w')
80 80 f.close()
81 81 repo.invalidate()
82 print "* empty file y created"
82 print("* empty file y created")
83 83 # should recreate the object
84 84 repo.cached
85 85
@@ -87,7 +87,7 b' def basic(repo):'
87 87 f.write('A')
88 88 f.close()
89 89 repo.invalidate()
90 print "* file y changed size"
90 print("* file y changed size")
91 91 # should recreate the object
92 92 repo.cached
93 93
@@ -96,7 +96,7 b' def basic(repo):'
96 96 f.close()
97 97
98 98 repo.invalidate()
99 print "* file y changed inode"
99 print("* file y changed inode")
100 100 repo.cached
101 101
102 102 f = scmutil.opener('.')('x', 'w', atomictemp=True)
@@ -107,7 +107,7 b' def basic(repo):'
107 107 f.close()
108 108
109 109 repo.invalidate()
110 print "* both files changed inode"
110 print("* both files changed inode")
111 111 repo.cached
112 112
113 113 def fakeuncacheable():
@@ -152,36 +152,36 b' def setbeforeget(repo):'
152 152 os.remove('y')
153 153 repo.cached = 'string set externally'
154 154 repo.invalidate()
155 print "* neither file exists"
156 print repo.cached
155 print("* neither file exists")
156 print(repo.cached)
157 157 repo.invalidate()
158 158 f = open('x', 'w')
159 159 f.write('a')
160 160 f.close()
161 print "* file x created"
162 print repo.cached
161 print("* file x created")
162 print(repo.cached)
163 163
164 164 repo.cached = 'string 2 set externally'
165 165 repo.invalidate()
166 print "* string set externally again"
167 print repo.cached
166 print("* string set externally again")
167 print(repo.cached)
168 168
169 169 repo.invalidate()
170 170 f = open('y', 'w')
171 171 f.write('b')
172 172 f.close()
173 print "* file y created"
174 print repo.cached
173 print("* file y created")
174 print(repo.cached)
175 175
176 print 'basic:'
177 print
176 print('basic:')
177 print()
178 178 basic(fakerepo())
179 print
180 print 'fakeuncacheable:'
181 print
179 print()
180 print('fakeuncacheable:')
181 print()
182 182 fakeuncacheable()
183 183 test_filecache_synced()
184 print
185 print 'setbeforeget:'
186 print
184 print()
185 print('setbeforeget:')
186 print()
187 187 setbeforeget(fakerepo())
General Comments 0
You need to be logged in to leave comments. Login now