()
| 26 | partial_module = "partial" |
| 27 | complete_module = "complete" |
| 28 | def importer(): |
| 29 | imp.acquire_lock() |
| 30 | sys.modules[fake_module_name] = partial_module |
| 31 | import_started.set() |
| 32 | time.sleep(0.01) # Give the other thread time to try and acquire. |
| 33 | sys.modules[fake_module_name] = complete_module |
| 34 | imp.release_lock() |
| 35 | t = threading.Thread(target=importer) |
| 36 | t.start() |
| 37 | import_started.wait() |
no test coverage detected