The following forum message was posted by piotr_dobrogost at http://sourceforge.net/projects/pydev/forums/forum/293649/topic/4943837:
Hi! It seems using socket module patched by gevent lib makes PyDev test runner dysfunctional. PyDev test runner uses xmlrpclib (which in turn uses httplib, which in turn uses socket). Running any test where socket is patched by gevent makes test runner fail with "NotImplementedError: gevent is only usable from a single thread". Below is a "test case" and output. In case someone knows how to handle this I would gladly hear the solution. [code]from gevent import monkey monkey.patch_all(socket=True, # socket=False makes PyDev test runner run ok dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, aggressive=True) import gevent import unittest def gevent_spawn(): def f(x): print "f: ", x greens = [gevent.spawn(f, x) for x in range(4)] gevent.joinall(greens) class Test(unittest.TestCase): def test(self): gevent_spawn() if __name__ == '__main__': gevent_spawn()[/code] OUTPUT [code]pydev debugger: starting Finding files... done. Importing test modules ... done. Traceback (most recent call last): File "C:\eclipse\indigo\plugins\org.python.pydev.debug_2.3.0.2011122300\pysrc\ pydev_runfiles_xml_rpc.py", line 131, in run self.server.notifyCommands(commands) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1575, in __request verbose=self.__verbose File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1292, in single_request self.send_content(h, request_body) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1439, in send_content connection.endheaders(request_body) File "c:\program files\python\2.7\Lib\httplib.py", line 951, in endheaders self._send_output(message_body) File "c:\program files\python\2.7\Lib\httplib.py", line 811, in _send_output self.send(msg) File "c:\program files\python\2.7\Lib\httplib.py", line 773, in send self.connect() File "c:\program files\python\2.7\Lib\httplib.py", line 754, in connect self.timeout, self.source_address) File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-amd6 4.egg\gevent\socket.py", line 641, in create_connection f: sock.connect(sa) 0 File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-am d64.egg\gevent\socket.py", line 371, in connect wait_readwrite(sock.fileno(), event=self._rw_event) File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-amd6 4.egg\gevent\socket.py", line 215, in wait_readwrite f: switch_result = get_hub().switch() 1 File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-amd6 4.egg\gevent\hub.py", line 135, in get_hub f: 2 raise NotImplementedError('gevent is only usable from a single thread') f: 3 NotImplementedError: gevent is only usable from a single thread ---------------------------------------------------------------------- Ran 1 test in 0.012s OK Traceback (most recent call last): File "C:\eclipse\indigo\plugins\org.python.pydev.debug_2.3.0.2011122300\pysrc\ pydev_runfiles_xml_rpc.py", line 131, in run self.server.notifyCommands(commands) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1575, in __request verbose=self.__verbose File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1292, in single_request self.send_content(h, request_body) File "c:\program files\python\2.7\Lib\xmlrpclib.py", line 1439, in send_content connection.endheaders(request_body) File "c:\program files\python\2.7\Lib\httplib.py", line 951, in endheaders self._send_output(message_body) File "c:\program files\python\2.7\Lib\httplib.py", line 811, in _send_output self.send(msg) File "c:\program files\python\2.7\Lib\httplib.py", line 773, in send self.connect() File "c:\program files\python\2.7\Lib\httplib.py", line 754, in connect self.timeout, self.source_address) File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-amd6 4.egg\gevent\socket.py", line 641, in create_connection sock.connect(sa) File "C:\python\virtualenv\envX\lib\site-packages\gevent-0.13.6-py2.7-win-amd6 4.egg\gevent\socket.py", line 371, in connect ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ Pydev-users mailing list Pydev-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pydev-users