From ea37274c09d7062770d4521a6c119c9e2b07b721 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 27 Oct 2014 14:19:51 +0800 Subject: [PATCH] test/pc_rpc: support slow server startups --- test/pc_rpc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/pc_rpc.py b/test/pc_rpc.py index 37a3d6c7d..b6cd4f323 100644 --- a/test/pc_rpc.py +++ b/test/pc_rpc.py @@ -22,8 +22,14 @@ class RPCCase(unittest.TestCase): test_object = [5, 2.1, None, True, False, {"a": 5, 2: np.linspace(0, 10, 1)}, (4, 5), (10,), "ab\nx\"'"] - time.sleep(.5) # wait for the server to start - remote = pc_rpc.Client(test_address, test_port) + for attempt in range(100): + time.sleep(.2) + try: + remote = pc_rpc.Client(test_address, test_port) + except ConnectionRefusedError: + pass + else: + break try: test_object_back = remote.echo(test_object) with self.assertRaises(pc_rpc.RemoteError):