tests/test-commandserver.py
changeset 15541 3aee6e26b28b
parent 14939 b4c06b97dfe0
child 15542 e19302598df8
equal deleted inserted replaced
15540:ad2c5561cada 15541:3aee6e26b28b
    24         return channel, length
    24         return channel, length
    25     else:
    25     else:
    26         return channel, server.stdout.read(length)
    26         return channel, server.stdout.read(length)
    27 
    27 
    28 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None):
    28 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None):
       
    29     print ' runcommand', ' '.join(args)
    29     server.stdin.write('runcommand\n')
    30     server.stdin.write('runcommand\n')
    30     writeblock(server, '\0'.join(args))
    31     writeblock(server, '\0'.join(args))
    31 
    32 
    32     if not input:
    33     if not input:
    33         input = cStringIO.StringIO()
    34         input = cStringIO.StringIO()
    50             print "unexpected channel %c: %r" % (ch, data)
    51             print "unexpected channel %c: %r" % (ch, data)
    51             if ch.isupper():
    52             if ch.isupper():
    52                 return
    53                 return
    53 
    54 
    54 def check(func, repopath=None):
    55 def check(func, repopath=None):
       
    56     print
       
    57     print 'testing %s:' % func.__name__
       
    58     print
    55     server = connect(repopath)
    59     server = connect(repopath)
    56     try:
    60     try:
    57         return func(server)
    61         return func(server)
    58     finally:
    62     finally:
    59         server.stdin.close()
    63         server.stdin.close()