diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t --- a/tests/test-bundle2-format.t +++ b/tests/test-bundle2-format.t @@ -166,6 +166,8 @@ Create an extension to test bundle2 API > 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 @@ Create an extension to test bundle2 API > 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): diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -7,9 +7,11 @@ Test basic extension support > command = cmdutil.command(cmdtable) > def uisetup(ui): > ui.write("uisetup called\\n") + > ui.flush() > def reposetup(ui, repo): > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) + > ui.flush() > @command('foo', [], 'hg foo') > def foo(ui, *args, **kwargs): > ui.write("Foo\\n") @@ -183,6 +185,7 @@ Check absolute/relative import of extens > import foo > def extsetup(ui): > ui.write('(extroot) ', foo.func(), '\n') + > ui.flush() > EOF $ cat > $TESTTMP/extroot/foo.py < from mercurial import extensions > def reposetup(ui, repo): > ui.write('reposetup() for %s\n' % (repo.root)) + > ui.flush() > EOF $ hg init src $ echo a > src/a diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -935,7 +935,7 @@ Test heads computation on pending index > opts['message'] = 'Test' > opts['logfile'] = None > cmdutil.amend(ui, repo, commitfunc, repo['.'], {}, pats, opts) - > print repo.changelog.headrevs() + > ui.write('%s\n' % repo.changelog.headrevs()) > EOF $ cat >> $HGRCPATH << EOF > [extensions]