Commit 73822cb7 authored by Neal Norwitz's avatar Neal Norwitz

Reduce the race condition by signalling when the server is ready

and not trying to connect before.
parent 2954ddcc
......@@ -13,6 +13,7 @@ def server(evt):
serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serv.bind(("", 9091))
serv.listen(5)
evt.set()
try:
conn, addr = serv.accept()
except socket.timeout:
......@@ -26,6 +27,8 @@ class GeneralTests(TestCase):
def setUp(self):
self.evt = threading.Event()
threading.Thread(target=server, args=(self.evt,)).start()
self.evt.wait()
self.evt.clear()
time.sleep(.1)
def tearDown(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment