tests/test-bundle2-format.t
changeset 28612 6fb1d3c936d2
parent 28238 b57d45ec33b2
child 29592 37cccad55410
--- a/tests/test-bundle2-format.t	Sun Mar 20 15:09:29 2016 -0700
+++ b/tests/test-bundle2-format.t	Tue Mar 15 09:51:42 2016 +0000
@@ -166,6 +166,8 @@
   >             file.write(chunk)
   >     except RuntimeError, exc:
   >         raise error.Abort(exc)
+  >     finally:
+  >         file.flush()
   > 
   > @command('unbundle2', [], '')
   > def cmdunbundle2(ui, repo, replypath=None):
@@ -194,9 +196,9 @@
   >     for rec in op.records['changegroup']:
   >         ui.write('addchangegroup return: %i\n' % rec['return'])
   >     if op.reply is not None and replypath is not None:
-  >         file = open(replypath, 'wb')
-  >         for chunk in op.reply.getchunks():
-  >             file.write(chunk)
+  >         with open(replypath, 'wb') as file:
+  >             for chunk in op.reply.getchunks():
+  >                 file.write(chunk)
   > 
   > @command('statbundle2', [], '')
   > def cmdstatbundle2(ui, repo):