D3511: tests: port test-dispatch.py to Python 3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu May 10 06:42:12 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG32106c474086: tests: port test-dispatch.py to Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3511?vs=8585&id=8603

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