comparison tests/test-commandserver.py @ 16117:6ecf5fb2a475 stable

test-commandserver: flush stdout
author Idan Kamara <idankk86@gmail.com>
date Thu, 16 Feb 2012 01:23:45 +0200
parents ce0ad184f489
children fb7c4c14223f
comparison
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()