From e89ab6822327f6b20c86fca9a7b97e9d56a7d4d0 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 23 Apr 2019 14:42:07 +0200 Subject: Reconnect if no pong is received for 12 seconds 12 seconds is a bit more than twice the amount of time between the pings we send. Fixes #238, fixes #480, fixes #561 --- _pytest/conftest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '_pytest') diff --git a/_pytest/conftest.py b/_pytest/conftest.py index 1af03c7..043b125 100644 --- a/_pytest/conftest.py +++ b/_pytest/conftest.py @@ -6,6 +6,8 @@ import random import string import sys +from websocket import ABNF + sys.path.append(".") import wee_slack @@ -16,9 +18,11 @@ class fakewebsocket(object): self.returndata = [] self.sentdata = [] def add(self, data): - self.returndata.append(data) + self.returndata.append(json.dumps(data).encode('utf-8')) def recv(self): - return json.dumps(self.returndata.pop(0)) + return self.recv_data()[1].decode('utf-8') + def recv_data(self, control_frame=False): + return ABNF.OPCODE_TEXT, self.returndata.pop(0) def send(self, data): self.sentdata.append(data) -- cgit