Commit f7a2fb2c authored by Denis Bilenko's avatar Denis Bilenko

update test__refcount.py with regard to the changes in socket

parent bfb7e3b9
...@@ -22,8 +22,15 @@ ...@@ -22,8 +22,15 @@
"""This test checks that socket instances (not gevent.socket.socket but underlying sockets) """This test checks that socket instances (not gevent.socket.socket but underlying sockets)
are not leaked by the hub. are not leaked by the hub.
""" """
from gevent import monkey from _socket import socket
monkey.patch_all() class Socket(socket):
"Something we can have a weakref to"
import _socket
_socket.socket = Socket
from gevent import monkey; monkey.patch_all()
#import sys #import sys
import greentest import greentest
from pprint import pformat from pprint import pformat
...@@ -32,14 +39,6 @@ from time import sleep ...@@ -32,14 +39,6 @@ from time import sleep
import weakref import weakref
import gc import gc
from _socket import socket
class Socket(socket):
"Something we can have a weakref to"
import _socket
_socket.socket = Socket
import socket import socket
socket._realsocket = Socket socket._realsocket = Socket
...@@ -90,9 +89,9 @@ def run_interaction(run_client): ...@@ -90,9 +89,9 @@ def run_interaction(run_client):
port = s.getsockname()[1] port = s.getsockname()[1]
start_new_thread(make_request, (port, )) start_new_thread(make_request, (port, ))
sleep(0.1+SOCKET_TIMEOUT) sleep(0.1+SOCKET_TIMEOUT)
#print sys.getrefcount(s.fd) #print sys.getrefcount(s._sock)
#s.close() #s.close()
return weakref.ref(s.fd) # XXX OR _sock depending on whether monkey patching is enabled. rename GreenSocket.fd to GreenSocket._sock ? return weakref.ref(s._sock)
def run_and_check(run_client): def run_and_check(run_client):
w = run_interaction(run_client=run_client) w = run_interaction(run_client=run_client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment