From d6827a37d00f3fcdac56e5dd978400e9ec1a7371 Mon Sep 17 00:00:00 2001 From: Michael Newman Date: Thu, 15 Mar 2012 14:41:45 -0400 Subject: [PATCH] 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. --- requests/async.py | 2 +- tests/test_requests_async.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 tests/test_requests_async.py 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() -- 2.34.1