Mercurial > hg
comparison tests/test-ui-color.py @ 14614:afccc64eea73
ui: use I/O descriptors internally
and as a result:
- fix webproto to redirect the ui descriptors instead of sys.stdout/err
- fix sshserver to use the ui descriptors
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 08 Jun 2011 01:39:20 +0300 |
parents | 842a9179132c |
children | a08775ec89f2 |
comparison
equal
deleted
inserted
replaced
14613:ea8938d3a5aa | 14614:afccc64eea73 |
---|---|
17 hgrc.close() | 17 hgrc.close() |
18 | 18 |
19 ui_ = ui.ui() | 19 ui_ = ui.ui() |
20 ui_.setconfig('ui', 'formatted', 'True') | 20 ui_.setconfig('ui', 'formatted', 'True') |
21 | 21 |
22 # we're not interested in the output, so write that to devnull | |
23 ui_.fout = open(os.devnull, 'w') | |
24 | |
22 # call some arbitrary command just so we go through | 25 # call some arbitrary command just so we go through |
23 # color's wrapped _runcommand twice. | 26 # color's wrapped _runcommand twice. |
24 # we're not interested in the output, so write that to devnull | |
25 def runcmd(): | 27 def runcmd(): |
26 sys.stdout = open(os.devnull, 'w') | |
27 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) | 28 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) |
28 sys.stdout = sys.__stdout__ | |
29 | 29 |
30 runcmd() | 30 runcmd() |
31 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) | 31 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) |
32 runcmd() | 32 runcmd() |
33 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) | 33 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) |