forked from pool/python-pytest-listener
48 lines
1.3 KiB
Diff
48 lines
1.3 KiB
Diff
|
|
Index: pytest-listener-1.7.0/pytest_listener.py
|
||
|
|
===================================================================
|
||
|
|
--- pytest-listener-1.7.0.orig/pytest_listener.py
|
||
|
|
+++ pytest-listener-1.7.0/pytest_listener.py
|
||
|
|
@@ -3,14 +3,13 @@
|
||
|
|
import collections
|
||
|
|
import json
|
||
|
|
import logging
|
||
|
|
+import pickle
|
||
|
|
import socket
|
||
|
|
import time
|
||
|
|
from threading import Thread, Event
|
||
|
|
from time import sleep
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
-from six import string_types
|
||
|
|
-from six.moves import cPickle
|
||
|
|
from pytest_server_fixtures.base import get_ephemeral_port, get_ephemeral_host
|
||
|
|
|
||
|
|
TERMINATOR = json.dumps(['STOP']).encode('utf-8')
|
||
|
|
@@ -59,7 +58,7 @@ class TimedMsg(object):
|
||
|
|
return 'TimedMsg: %s (@ %s)' % (str(self.value), self.time)
|
||
|
|
|
||
|
|
def pickled(self):
|
||
|
|
- return cPickle.dumps(self)
|
||
|
|
+ return pickle.dumps(self)
|
||
|
|
|
||
|
|
|
||
|
|
class Listener(Thread):
|
||
|
|
@@ -114,7 +113,7 @@ class Listener(Thread):
|
||
|
|
return None, None
|
||
|
|
|
||
|
|
try:
|
||
|
|
- data = cPickle.loads(data)
|
||
|
|
+ data = pickle.loads(data)
|
||
|
|
except:
|
||
|
|
try:
|
||
|
|
data = data.decode('utf-8')
|
||
|
|
@@ -128,7 +127,7 @@ class Listener(Thread):
|
||
|
|
if isinstance(data, TimedMsg):
|
||
|
|
d = data.value
|
||
|
|
t = data.time
|
||
|
|
- elif isinstance(data, string_types):
|
||
|
|
+ elif isinstance(data, str):
|
||
|
|
try:
|
||
|
|
d = json.loads(data)
|
||
|
|
except:
|