From: Michael Newman Date: Thu, 15 Mar 2012 18:41:45 +0000 (-0400) Subject: Excluding select from the monkey patching that gevent does to allow select.poll and... X-Git-Tag: v0.11.1~11^2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6827a37d00f3fcdac56e5dd978400e9ec1a7371;p=services%2Fpython-requests.git Excluding select from the monkey patching that gevent does to allow select.poll and requests.async in the same project Fix for issue #487, including a regression test that checks the existence of select.poll before and after loading requests.async. --- diff --git a/requests/async.py b/requests/async.py index f2dad69..f12cf26 100644 --- a/requests/async.py +++ b/requests/async.py @@ -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 diff --git a/tests/test_requests_async.py b/tests/test_requests_async.py old mode 100644 new mode 100755 index 2d37bbb..1d28261 --- a/tests/test_requests_async.py +++ b/tests/test_requests_async.py @@ -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()