test/pc_rpc: support slow server startups

This commit is contained in:
Sebastien Bourdeauducq 2014-10-27 14:19:51 +08:00
parent 934442bd07
commit ea37274c09
1 changed files with 8 additions and 2 deletions

View File

@ -22,8 +22,14 @@ class RPCCase(unittest.TestCase):
test_object = [5, 2.1, None, True, False, test_object = [5, 2.1, None, True, False,
{"a": 5, 2: np.linspace(0, 10, 1)}, {"a": 5, 2: np.linspace(0, 10, 1)},
(4, 5), (10,), "ab\nx\"'"] (4, 5), (10,), "ab\nx\"'"]
time.sleep(.5) # wait for the server to start for attempt in range(100):
time.sleep(.2)
try:
remote = pc_rpc.Client(test_address, test_port) remote = pc_rpc.Client(test_address, test_port)
except ConnectionRefusedError:
pass
else:
break
try: try:
test_object_back = remote.echo(test_object) test_object_back = remote.echo(test_object)
with self.assertRaises(pc_rpc.RemoteError): with self.assertRaises(pc_rpc.RemoteError):