tests/test-ui-color.py
changeset 14614 afccc64eea73
parent 14516 842a9179132c
child 17956 a08775ec89f2
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))