aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-04-02 11:03:05 +1200
committerAldo Cortesi <aldo@corte.si>2018-04-02 11:03:05 +1200
commit2b040ff09374ad50b0878c18296beb4d9147d075 (patch)
tree228c896bff7f1b0b74f4df15b6c1ffa62ecb0a79 /test
parent28a8ddc0e827149c76a738e6363713ed2ebc0eac (diff)
downloadmitmproxy-2b040ff09374ad50b0878c18296beb4d9147d075.tar.gz
mitmproxy-2b040ff09374ad50b0878c18296beb4d9147d075.tar.bz2
mitmproxy-2b040ff09374ad50b0878c18296beb4d9147d075.zip
asyncio: make http2 tests pass
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/proxy/protocol/test_http2.py7
-rw-r--r--test/mitmproxy/tservers.py1
2 files changed, 6 insertions, 2 deletions
diff --git a/test/mitmproxy/proxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py
index 8b929995..1cc36402 100644
--- a/test/mitmproxy/proxy/protocol/test_http2.py
+++ b/test/mitmproxy/proxy/protocol/test_http2.py
@@ -6,11 +6,11 @@ import tempfile
import traceback
import pytest
import h2
+import time
from mitmproxy import options
import mitmproxy.net
-from mitmproxy.addons import core
from ...net import tservers as net_tservers
from mitmproxy import exceptions
from mitmproxy.net.http import http1, http2
@@ -92,6 +92,10 @@ 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):
@@ -118,6 +122,7 @@ class _Http2TestBase:
def teardown(self):
if self.client:
self.client.close()
+ self.server.server.wait_for_silence()
def setup_connection(self):
self.client = mitmproxy.net.tcp.TCPClient(("127.0.0.1", self.proxy.port))
diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py
index 18e4f27d..d72ca138 100644
--- a/test/mitmproxy/tservers.py
+++ b/test/mitmproxy/tservers.py
@@ -122,7 +122,6 @@ class ProxyThread(threading.Thread):
self.tmaster.addons.trigger("tick")
-
class ProxyTestBase:
# Test Configuration
ssl = None