tests/test-ui-color.py
changeset 36337 0f36926b2651
parent 36336 236596a67a54
child 37925 b8c2004a8d2b
equal deleted inserted replaced
36336:236596a67a54 36337:0f36926b2651
    13 testui.warn((b'warning\n'))
    13 testui.warn((b'warning\n'))
    14 testui.write_err(b'error\n')
    14 testui.write_err(b'error\n')
    15 print(repr(testui.popbuffer()))
    15 print(repr(testui.popbuffer()))
    16 
    16 
    17 # test dispatch.dispatch with the same ui object
    17 # test dispatch.dispatch with the same ui object
    18 hgrc = open(os.environ["HGRCPATH"], 'w')
    18 hgrc = open(os.environ["HGRCPATH"], 'wb')
    19 hgrc.write(b'[extensions]\n')
    19 hgrc.write(b'[extensions]\n')
    20 hgrc.write(b'color=\n')
    20 hgrc.write(b'color=\n')
    21 hgrc.close()
    21 hgrc.close()
    22 
    22 
    23 ui_ = uimod.ui.load()
    23 ui_ = uimod.ui.load()
    24 ui_.setconfig(b'ui', b'formatted', b'True')
    24 ui_.setconfig(b'ui', b'formatted', b'True')
    25 
    25 
    26 # we're not interested in the output, so write that to devnull
    26 # we're not interested in the output, so write that to devnull
    27 ui_.fout = open(os.devnull, 'w')
    27 ui_.fout = open(os.devnull, 'wb')
    28 
    28 
    29 # call some arbitrary command just so we go through
    29 # call some arbitrary command just so we go through
    30 # color's wrapped _runcommand twice.
    30 # color's wrapped _runcommand twice.
    31 def runcmd():
    31 def runcmd():
    32     dispatch.dispatch(dispatch.request([b'version', b'-q'], ui_))
    32     dispatch.dispatch(dispatch.request([b'version', b'-q'], ui_))