aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/conftest.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-04-23 14:42:07 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-04-23 14:58:59 +0200
commite89ab6822327f6b20c86fca9a7b97e9d56a7d4d0 (patch)
tree7ce303b997ae95c0d5f6f3e26a8695eb884b2ac4 /_pytest/conftest.py
parent6aafb4620fb4407190c4a7c02bdc26f20546c83f (diff)
downloadwee-slack-e89ab6822327f6b20c86fca9a7b97e9d56a7d4d0.tar.gz
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
Diffstat (limited to '_pytest/conftest.py')
-rw-r--r--_pytest/conftest.py8
1 files changed, 6 insertions, 2 deletions
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)