Skip to content
Myr

Excluding select from the monkey patching that gevent does to allow select.poll and requests.async in the same project

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix for issue #487, including a regression test that checks the existence of select.poll before and after loading requests.async.

authored by Michael Newman · committed by Michael Newman · parent 5b7a79b · Browse files · 2 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−1 removed

  • tests:+6 added−0 removed
  • other:+1 added−1 removed

2 files+7 added−1 removed

modified:requests/async.py+1 added-1 removed
15 unmodified lines
16except ImportError:17 raise RuntimeError('Gevent is required for requests.async.')1819# Monkey-patch.20curious_george.patch_all(thread=False)20curious_george.patch_all(thread=False, select=False)2122from . import api2324
82 unmodified lines
modified:tests/test_requests_async.py+6 added
6 unmodified lines
78import sys9import unittest1011import select12has_poll = hasattr(select, "poll")1314from requests import async15import envoy1617sys.path.append('.')
41 unmodified lines
5960 async.map61 async.send6263 def test_select_poll(self):64 """Test to make sure we don't overwrite the poll"""65 self.assertEqual(hasattr(select, "poll"), has_poll)6667if __name__ == '__main__':68 unittest.main()