D3511: tests: port test-dispatch.py to Python 3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Tue May 8 20:46:26 UTC 2018
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3511
AFFECTED FILES
contrib/python3-whitelist
tests/test-dispatch.py
CHANGE DETAILS
diff --git a/tests/test-dispatch.py b/tests/test-dispatch.py
--- a/tests/test-dispatch.py
+++ b/tests/test-dispatch.py
@@ -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')
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -105,6 +105,7 @@
test-dirstate-backup.t
test-dirstate-nonnormalset.t
test-dirstate.t
+test-dispatch.py
test-doctest.py
test-double-merge.t
test-drawdag.t
To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list