tests/isolated/patcher_importlib_lock.py
raw| 1 | __test__ = False |
| 2 | |
| 3 | |
| 4 | def do_import(): |
| 5 | import encodings.idna |
| 6 | |
| 7 | |
| 8 | if __name__ == '__main__': |
| 9 | import sys |
| 10 | import eventlet |
| 11 | |
| 12 | eventlet.monkey_patch() |
| 13 | threading = eventlet.patcher.original('threading') |
| 14 | |
| 15 | sys.modules.pop('encodings.idna', None) |
| 16 | |
| 17 | # call "import encodings.idna" in a new thread |
| 18 | thread = threading.Thread(target=do_import) |
| 19 | thread.start() |
| 20 | |
| 21 | # call "import encodings.idna" in the main thread |
| 22 | do_import() |
| 23 | |
| 24 | thread.join() |
| 25 | print('pass') |