##// END OF EJS Templates
tests: port test-dispatch.py to Python 3...
Augie Fackler -
r37943:32106c47 default
parent child Browse files
Show More
@@ -105,6 +105,7 b' test-directaccess.t'
105 test-dirstate-backup.t
105 test-dirstate-backup.t
106 test-dirstate-nonnormalset.t
106 test-dirstate-nonnormalset.t
107 test-dirstate.t
107 test-dirstate.t
108 test-dispatch.py
108 test-doctest.py
109 test-doctest.py
109 test-double-merge.t
110 test-double-merge.t
110 test-drawdag.t
111 test-drawdag.t
@@ -1,18 +1,24 b''
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2 import os
2 import os
3 import sys
3 from mercurial import (
4 from mercurial import (
4 dispatch,
5 dispatch,
5 )
6 )
6
7
8 def printb(data, end=b'\n'):
9 out = getattr(sys.stdout, 'buffer', sys.stdout)
10 out.write(data + end)
11 out.flush()
12
7 def testdispatch(cmd):
13 def testdispatch(cmd):
8 """Simple wrapper around dispatch.dispatch()
14 """Simple wrapper around dispatch.dispatch()
9
15
10 Prints command and result value, but does not handle quoting.
16 Prints command and result value, but does not handle quoting.
11 """
17 """
12 print(b"running: %s" % (cmd,))
18 printb(b"running: %s" % (cmd,))
13 req = dispatch.request(cmd.split())
19 req = dispatch.request(cmd.split())
14 result = dispatch.dispatch(req)
20 result = dispatch.dispatch(req)
15 print(b"result: %r" % (result,))
21 printb(b"result: %r" % (result,))
16
22
17 testdispatch(b"init test1")
23 testdispatch(b"init test1")
18 os.chdir('test1')
24 os.chdir('test1')
General Comments 0
You need to be logged in to leave comments. Login now