Show More
@@ -72,15 +72,15 def basic(repo): | |||||
72 | repo.cached |
|
72 | repo.cached | |
73 |
|
73 | |||
74 | # create empty file |
|
74 | # create empty file | |
75 | f = open('x', 'w') |
|
75 | f = open('x', 'wb') | |
76 | f.close() |
|
76 | f.close() | |
77 | repo.invalidate() |
|
77 | repo.invalidate() | |
78 | print("* empty file x created") |
|
78 | print("* empty file x created") | |
79 | # should recreate the object |
|
79 | # should recreate the object | |
80 | repo.cached |
|
80 | repo.cached | |
81 |
|
81 | |||
82 | f = open('x', 'w') |
|
82 | f = open('x', 'wb') | |
83 | f.write('a') |
|
83 | f.write(b'a') | |
84 | f.close() |
|
84 | f.close() | |
85 | repo.invalidate() |
|
85 | repo.invalidate() | |
86 | print("* file x changed size") |
|
86 | print("* file x changed size") | |
@@ -104,15 +104,15 def basic(repo): | |||||
104 | repo.cached |
|
104 | repo.cached | |
105 |
|
105 | |||
106 | # create empty file y |
|
106 | # create empty file y | |
107 | f = open('y', 'w') |
|
107 | f = open('y', 'wb') | |
108 | f.close() |
|
108 | f.close() | |
109 | repo.invalidate() |
|
109 | repo.invalidate() | |
110 | print("* empty file y created") |
|
110 | print("* empty file y created") | |
111 | # should recreate the object |
|
111 | # should recreate the object | |
112 | repo.cached |
|
112 | repo.cached | |
113 |
|
113 | |||
114 | f = open('y', 'w') |
|
114 | f = open('y', 'wb') | |
115 | f.write('A') |
|
115 | f.write(b'A') | |
116 | f.close() |
|
116 | f.close() | |
117 | repo.invalidate() |
|
117 | repo.invalidate() | |
118 | print("* file y changed size") |
|
118 | print("* file y changed size") | |
@@ -151,7 +151,7 def fakeuncacheable(): | |||||
151 | util.cachestat, 'cacheable', wrapcacheable |
|
151 | util.cachestat, 'cacheable', wrapcacheable | |
152 | ) |
|
152 | ) | |
153 |
|
153 | |||
154 | for fn in ['x', 'y']: |
|
154 | for fn in [b'x', b'y']: | |
155 | try: |
|
155 | try: | |
156 | os.remove(fn) |
|
156 | os.remove(fn) | |
157 | except OSError: |
|
157 | except OSError: | |
@@ -180,15 +180,15 def test_filecache_synced(): | |||||
180 |
|
180 | |||
181 |
|
181 | |||
182 | def setbeforeget(repo): |
|
182 | def setbeforeget(repo): | |
183 | os.remove('x') |
|
183 | os.remove(b'x') | |
184 | os.remove('y') |
|
184 | os.remove(b'y') | |
185 | repo.__class__.cached.set(repo, 'string set externally') |
|
185 | repo.__class__.cached.set(repo, 'string set externally') | |
186 | repo.invalidate() |
|
186 | repo.invalidate() | |
187 | print("* neither file exists") |
|
187 | print("* neither file exists") | |
188 | print(repo.cached) |
|
188 | print(repo.cached) | |
189 | repo.invalidate() |
|
189 | repo.invalidate() | |
190 | f = open('x', 'w') |
|
190 | f = open('x', 'wb') | |
191 | f.write('a') |
|
191 | f.write(b'a') | |
192 | f.close() |
|
192 | f.close() | |
193 | print("* file x created") |
|
193 | print("* file x created") | |
194 | print(repo.cached) |
|
194 | print(repo.cached) | |
@@ -199,8 +199,8 def setbeforeget(repo): | |||||
199 | print(repo.cached) |
|
199 | print(repo.cached) | |
200 |
|
200 | |||
201 | repo.invalidate() |
|
201 | repo.invalidate() | |
202 | f = open('y', 'w') |
|
202 | f = open('y', 'wb') | |
203 | f.write('b') |
|
203 | f.write(b'b') | |
204 | f.close() |
|
204 | f.close() | |
205 | print("* file y created") |
|
205 | print("* file y created") | |
206 | print(repo.cached) |
|
206 | print(repo.cached) | |
@@ -212,8 +212,8 def antiambiguity(): | |||||
212 | # try some times, because reproduction of ambiguity depends on |
|
212 | # try some times, because reproduction of ambiguity depends on | |
213 | # "filesystem time" |
|
213 | # "filesystem time" | |
214 | for i in range(5): |
|
214 | for i in range(5): | |
215 | fp = open(filename, 'w') |
|
215 | fp = open(filename, 'wb') | |
216 | fp.write('FOO') |
|
216 | fp.write(b'FOO') | |
217 | fp.close() |
|
217 | fp.close() | |
218 |
|
218 | |||
219 | oldstat = os.stat(filename) |
|
219 | oldstat = os.stat(filename) | |
@@ -227,13 +227,13 def antiambiguity(): | |||||
227 | # st_mtime is advanced multiple times as expected |
|
227 | # st_mtime is advanced multiple times as expected | |
228 | for i in range(repetition): |
|
228 | for i in range(repetition): | |
229 | # explicit closing |
|
229 | # explicit closing | |
230 | fp = vfsmod.checkambigatclosing(open(filename, 'a')) |
|
230 | fp = vfsmod.checkambigatclosing(open(filename, 'ab')) | |
231 | fp.write('FOO') |
|
231 | fp.write(b'FOO') | |
232 | fp.close() |
|
232 | fp.close() | |
233 |
|
233 | |||
234 | # implicit closing by "with" statement |
|
234 | # implicit closing by "with" statement | |
235 | with vfsmod.checkambigatclosing(open(filename, 'a')) as fp: |
|
235 | with vfsmod.checkambigatclosing(open(filename, 'ab')) as fp: | |
236 | fp.write('BAR') |
|
236 | fp.write(b'BAR') | |
237 |
|
237 | |||
238 | newstat = os.stat(filename) |
|
238 | newstat = os.stat(filename) | |
239 | if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]: |
|
239 | if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]: |
General Comments 0
You need to be logged in to leave comments.
Login now