X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftcptest.py;h=773ecbe54f9c770aeed8ab742568c9a0c52c7581;hb=c8e2f4e3a327181b29521583770a6f0ff68ca6eb;hp=f1512b671a47c9b60e58987bdc0c63819c669740;hpb=65c93a296f2e481a312e7846f518eb2eaa2fc080;p=tests.git diff --git a/system/tcptest.py b/system/tcptest.py index f1512b6..773ecbe 100755 --- a/system/tcptest.py +++ b/system/tcptest.py @@ -12,8 +12,8 @@ import threading from optparse import OptionParser def myprint(message, id='client'): - now=time.strftime("%H:%M:%S", time.localtime()) - print "*",now,'(%s)' % id, '--',message + now = time.strftime("%H:%M:%S", time.localtime()) + print "* {now} ({id}) -- {message}".format(**locals()) sys.stdout.flush() def show_network_status(id): @@ -127,15 +127,15 @@ class Client: mout=i*'ping ' + '\n' min=mout.upper() if s.send(mout) != len(mout): - myprint("cannot send %s"%mout.strip()) + myprint("cannot send {}".format(mout.strip())) result=False break line=s.recv(len(min)) if line is not line: - myprint("unexpected reception\ngot:%s\nexpected: %s",line,min) - result=False + myprint("unexpected reception\ngot:{}\nexpected: {}".format(line, min)) + result = False else: - myprint("OK:%s"%mout.strip()) + myprint("OK:{}".format(mout.strip())) # leave the connection open, but the last one (so 1 iter returns fast) if i != options.loops: time.sleep(options.sleep)