diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-01 23:27:50 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-04 09:52:28 +0100 |
commit | 738094e1674ae78f92ff32020e608510ff4af45a (patch) | |
tree | 107734e6b1704520cb1c1e5720229721a18e59e7 /test | |
parent | b007ff3f9b00165bd87c18292d8b23d4acc83ab9 (diff) | |
download | mitmproxy-738094e1674ae78f92ff32020e608510ff4af45a.tar.gz mitmproxy-738094e1674ae78f92ff32020e608510ff4af45a.tar.bz2 mitmproxy-738094e1674ae78f92ff32020e608510ff4af45a.zip |
improve test reliability
Diffstat (limited to 'test')
-rw-r--r-- | test/test_protocol_http2.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_protocol_http2.py b/test/test_protocol_http2.py index 831f70ab..dce8c5da 100644 --- a/test/test_protocol_http2.py +++ b/test/test_protocol_http2.py @@ -48,7 +48,10 @@ class _Http2ServerBase(netlib_tservers.ServerTestBase): self.wfile.flush() while True: - events = h2_conn.receive_data(b''.join(http2_read_raw_frame(self.rfile))) + try: + events = h2_conn.receive_data(b''.join(http2_read_raw_frame(self.rfile))) + except: + break self.wfile.write(h2_conn.data_to_send()) self.wfile.flush() @@ -362,8 +365,8 @@ class TestPushPromise(_Http2TestBase, _Http2ServerBase): ('foo', 'bar') ]) - done = False - while not done: + streams = 0 + while streams != 3: try: events = h2_conn.receive_data(b''.join(http2_read_raw_frame(client.rfile))) except: @@ -373,8 +376,9 @@ class TestPushPromise(_Http2TestBase, _Http2ServerBase): for event in events: if isinstance(event, h2.events.StreamEnded) and event.stream_id == 1: - done = True + streams += 1 elif isinstance(event, h2.events.PushedStreamReceived): + streams += 1 h2_conn.reset_stream(event.pushed_stream_id, error_code=0x8) client.wfile.write(h2_conn.data_to_send()) client.wfile.flush() |