pathoc -n 0 repeats forever

This commit is contained in:
Aldo Cortesi 2014-10-25 17:58:59 +13:00
parent 609d6eab30
commit fc4f9a1c7a
3 changed files with 9 additions and 3 deletions

View File

@ -36,7 +36,7 @@ def go_pathoc():
)
parser.add_argument(
"-n", dest='repeat', default=1, type=int, metavar="N",
help='Repeat N times'
help='Repeat N times. If 0 repeat for ever.'
)
parser.add_argument(
"-r", dest="random", action="store_true", default=False,

View File

@ -224,7 +224,9 @@ class Pathoc(tcp.TCPClient):
def main(args):
try:
for i in range(args.repeat):
cnt = 0
while 1:
cnt += 1
p = Pathoc(
(args.host, args.port),
ssl=args.ssl,
@ -258,5 +260,7 @@ def main(args):
sys.stdout.flush()
if ret and args.oneshot:
sys.exit(0)
if cnt == args.repeat:
break
except KeyboardInterrupt:
pass

View File

@ -696,7 +696,9 @@ class TestResponse:
testlen(r)
def test_parse_err(self):
tutils.raises(language.ParseException, language.parse_response, "400:msg,b:")
tutils.raises(
language.ParseException, language.parse_response, "400:msg,b:"
)
try:
language.parse_response("400'msg':b:")
except language.ParseException, v: