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

login
register
mail settings
Submitter phabricator
Date May 10, 2018, 10:42 a.m.
Message ID <69823d879150f4bfc16554bff56b1c5a@localhost.localdomain>
Download mbox | patch
Permalink /patch/31443/
State Not Applicable
Headers show

Comments

phabricator - May 10, 2018, 10:42 a.m.
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




To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

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