tests/test-commandserver.py
branchstable
changeset 16117 6ecf5fb2a475
parent 16116 ce0ad184f489
child 16201 fb7c4c14223f
equal deleted inserted replaced
16116:ce0ad184f489 16117:6ecf5fb2a475
    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     print ' runcommand', ' '.join(args)
       
    30     sys.stdout.flush()
    30     server.stdin.write('runcommand\n')
    31     server.stdin.write('runcommand\n')
    31     writeblock(server, '\0'.join(args))
    32     writeblock(server, '\0'.join(args))
    32 
    33 
    33     if not input:
    34     if not input:
    34         input = cStringIO.StringIO()
    35         input = cStringIO.StringIO()
    54 
    55 
    55 def check(func, repopath=None):
    56 def check(func, repopath=None):
    56     print
    57     print
    57     print 'testing %s:' % func.__name__
    58     print 'testing %s:' % func.__name__
    58     print
    59     print
       
    60     sys.stdout.flush()
    59     server = connect(repopath)
    61     server = connect(repopath)
    60     try:
    62     try:
    61         return func(server)
    63         return func(server)
    62     finally:
    64     finally:
    63         server.stdin.close()
    65         server.stdin.close()