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