File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -268,16 +268,17 @@ def test_iter_keepopenfile(tmpdir):
268
268
expected = list (map (str , range (10 )))
269
269
p = tmpdir .mkdir ('testdir' ).join ('testfile' )
270
270
p .write (os .linesep .join (expected ))
271
- f = p .open ()
272
- for e_line , a_line in zip (expected , click .utils .KeepOpenFile (f )):
273
- assert e_line == a_line .strip ()
271
+ with p .open () as f :
272
+ for e_line , a_line in zip (expected , click .utils .KeepOpenFile (f )):
273
+ assert e_line == a_line .strip ()
274
274
275
275
276
276
@pytest .mark .xfail (WIN and not PY2 , reason = 'God knows ...' )
277
277
def test_iter_lazyfile (tmpdir ):
278
278
expected = list (map (str , range (10 )))
279
279
p = tmpdir .mkdir ('testdir' ).join ('testfile' )
280
280
p .write (os .linesep .join (expected ))
281
- f = p .open ()
282
- for e_line , a_line in zip (expected , click .utils .LazyFile (f .name )):
283
- assert e_line == a_line .strip ()
281
+ with p .open () as f :
282
+ with click .utils .LazyFile (f .name ) as lf :
283
+ for e_line , a_line in zip (expected , lf ):
284
+ assert e_line == a_line .strip ()
You can’t perform that action at this time.
0 commit comments