Make sure __main__ module exists (and clean up after).
()
| 347 | |
| 348 | @contextlib.contextmanager |
| 349 | def using___main__(): |
| 350 | """Make sure __main__ module exists (and clean up after).""" |
| 351 | modname = '__main__' |
| 352 | if modname not in sys.modules: |
| 353 | with import_helper.isolated_modules(): |
| 354 | yield import_helper.add_module(modname) |
| 355 | else: |
| 356 | with import_helper.module_restored(modname) as mod: |
| 357 | yield mod |
| 358 | |
| 359 | |
| 360 | @contextlib.contextmanager |
no test coverage detected
searching dependent graphs…