mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
asyncio: factor out test server startup wait
This commit is contained in:
parent
14f461c5d5
commit
7e73e5fa51
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user