asyncio: factor out test server startup wait

This commit is contained in:
Aldo Cortesi 2018-04-03 09:46:11 +12:00
parent 14f461c5d5
commit 7e73e5fa51
3 changed files with 7 additions and 12 deletions

View File

@ -92,10 +92,6 @@ class _Http2TestBase:
cls.options = cls.get_options()
cls.proxy = tservers.ProxyThread(tservers.TestMaster, cls.options)
cls.proxy.start()
while True:
if cls.proxy.tmaster:
break
time.sleep(0.01)
@classmethod
def teardown_class(cls):

View File

@ -54,10 +54,6 @@ class _WebSocketTestBase:
cls.options = cls.get_options()
cls.proxy = tservers.ProxyThread(tservers.TestMaster, cls.options)
cls.proxy.start()
while True:
if cls.proxy.tmaster:
break
time.sleep(0.01)
@classmethod
def teardown_class(cls):

View File

@ -121,6 +121,13 @@ class ProxyThread(threading.Thread):
self.tmaster.reset(addons)
self.tmaster.addons.trigger("tick")
def start(self):
super().start()
while True:
if self.tmaster:
break
time.sleep(0.01)
class ProxyTestBase:
# Test Configuration
@ -142,10 +149,6 @@ class ProxyTestBase:
cls.options = cls.get_options()
cls.proxy = ProxyThread(cls.masterclass, cls.options)
cls.proxy.start()
while True:
if cls.proxy.tmaster:
break
time.sleep(0.01)
@classmethod
def teardown_class(cls):