Mercurial > public > mercurial-scm > hg-stable
diff tests/test-dispatch.py @ 37968:32106c474086
tests: port test-dispatch.py to Python 3
Differential Revision: https://phab.mercurial-scm.org/D3511
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 11:57:15 -0400 |
parents | f0c94af0d70d |
children | 2372284d9457 |
line wrap: on
line diff
--- a/tests/test-dispatch.py Fri Apr 27 11:55:04 2018 -0400 +++ b/tests/test-dispatch.py Fri Apr 27 11:57:15 2018 -0400 @@ -1,18 +1,24 @@ from __future__ import absolute_import, print_function import os +import sys from mercurial import ( dispatch, ) +def printb(data, end=b'\n'): + out = getattr(sys.stdout, 'buffer', sys.stdout) + out.write(data + end) + out.flush() + def testdispatch(cmd): """Simple wrapper around dispatch.dispatch() Prints command and result value, but does not handle quoting. """ - print(b"running: %s" % (cmd,)) + printb(b"running: %s" % (cmd,)) req = dispatch.request(cmd.split()) result = dispatch.dispatch(req) - print(b"result: %r" % (result,)) + printb(b"result: %r" % (result,)) testdispatch(b"init test1") os.chdir('test1')