Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG32106c474086: tests: port test-dispatch.py to Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/python3-whitelist (1 line) | |||
M | tests/test-dispatch.py (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Apr 27 2018, 11:57 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
test-diff-unified.t | test-diff-unified.t | ||||
test-diff-upgrade.t | test-diff-upgrade.t | ||||
test-diffdir.t | test-diffdir.t | ||||
test-diffstat.t | test-diffstat.t | ||||
test-directaccess.t | test-directaccess.t | ||||
test-dirstate-backup.t | test-dirstate-backup.t | ||||
test-dirstate-nonnormalset.t | test-dirstate-nonnormalset.t | ||||
test-dirstate.t | test-dirstate.t | ||||
test-dispatch.py | |||||
test-doctest.py | test-doctest.py | ||||
test-double-merge.t | test-double-merge.t | ||||
test-drawdag.t | test-drawdag.t | ||||
test-duplicateoptions.py | test-duplicateoptions.py | ||||
test-editor-filename.t | test-editor-filename.t | ||||
test-empty-dir.t | test-empty-dir.t | ||||
test-empty-file.t | test-empty-file.t | ||||
test-empty-group.t | test-empty-group.t |
from __future__ import absolute_import, print_function | from __future__ import absolute_import, print_function | ||||
import os | import os | ||||
import sys | |||||
from mercurial import ( | from mercurial import ( | ||||
dispatch, | dispatch, | ||||
) | ) | ||||
def printb(data, end=b'\n'): | |||||
out = getattr(sys.stdout, 'buffer', sys.stdout) | |||||
out.write(data + end) | |||||
out.flush() | |||||
def testdispatch(cmd): | def testdispatch(cmd): | ||||
"""Simple wrapper around dispatch.dispatch() | """Simple wrapper around dispatch.dispatch() | ||||
Prints command and result value, but does not handle quoting. | 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()) | req = dispatch.request(cmd.split()) | ||||
result = dispatch.dispatch(req) | result = dispatch.dispatch(req) | ||||
print(b"result: %r" % (result,)) | printb(b"result: %r" % (result,)) | ||||
testdispatch(b"init test1") | testdispatch(b"init test1") | ||||
os.chdir('test1') | os.chdir('test1') | ||||
# create file 'foo', add and commit | # create file 'foo', add and commit | ||||
f = open('foo', 'wb') | f = open('foo', 'wb') | ||||
f.write(b'foo\n') | f.write(b'foo\n') | ||||
f.close() | f.close() |