Excluding select from the monkey patching that gevent does to allow select.poll and...
authorMichael Newman <newmaniese@gmail.com>
Thu, 15 Mar 2012 18:41:45 +0000 (14:41 -0400)
committerMichael Newman <newmaniese@gmail.com>
Thu, 15 Mar 2012 18:41:45 +0000 (14:41 -0400)
Fix for issue #487, including a regression test that checks the
existence of select.poll before and after loading requests.async.

requests/async.py
tests/test_requests_async.py [changed mode: 0644->0755]

index f2dad6940caf5cfa8cfd0786f7112a858944562a..f12cf2687329300ef01f9417447078fdc9ee48d4 100644 (file)
@@ -17,7 +17,7 @@ except ImportError:
     raise RuntimeError('Gevent is required for requests.async.')
 
 # Monkey-patch.
-curious_george.patch_all(thread=False)
+curious_george.patch_all(thread=False, select=False)
 
 from . import api
 
old mode 100644 (file)
new mode 100755 (executable)
index 2d37bbb..1d28261
@@ -8,6 +8,9 @@ sys.path.insert(0, os.path.abspath('..'))
 import sys
 import unittest
 
+import select
+has_poll = hasattr(select, "poll")
+
 from requests import async
 import envoy
 
@@ -57,6 +60,9 @@ class RequestsTestSuiteUsingAsyncApi(RequestsTestSuite):
         async.map
         async.send
 
+    def test_select_poll(self):
+        """Test to make sure we don't overwrite the poll"""
+        self.assertEqual(hasattr(select, "poll"), has_poll)
 
 if __name__ == '__main__':
     unittest.main()