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