| 1 |
""" |
| 2 |
asyncio submodules continue to have the original, real socket module even after |
| 3 |
monkeypatching. |
| 4 |
""" |
| 5 |
|
| 6 |
import sys |
| 7 |
|
| 8 |
|
| 9 |
def assert_correct_patching(): |
| 10 |
from eventlet.greenio.base import GreenSocket |
| 11 |
import asyncio.selector_events |
| 12 |
if asyncio.selector_events.socket.socket is GreenSocket: |
| 13 |
raise RuntimeError("Wrong socket class, should've been normal socket.socket") |
| 14 |
|
| 15 |
import asyncio.selector_events |
| 16 |
if asyncio.selector_events.selectors is not sys.modules["__original_module_selectors"]: |
| 17 |
raise RuntimeError("Wrong selectors") |
| 18 |
|
| 19 |
if asyncio.selector_events.selectors.select is not sys.modules["__original_module_select"]: |
| 20 |
raise RuntimeError("Wrong select") |
| 21 |
|
| 22 |
|
| 23 |
import eventlet.hubs |
| 24 |
eventlet.hubs.get_hub() |
| 25 |
assert_correct_patching() |
| 26 |
|
| 27 |
import eventlet |
| 28 |
eventlet.monkey_patch() |
| 29 |
assert_correct_patching() |
| 30 |
|
| 31 |
|
| 32 |
print("pass") |