MCPcopy Index your code
hub / github.com/python/cpython / create_modules

Function create_modules

Lib/test/test_bdb.py:539–553  ·  view source on GitHub ↗
(modules)

Source from the content-addressed store, hash-verified

537
538@contextmanager
539def create_modules(modules):
540 with os_helper.temp_cwd():
541 sys.path.append(os.getcwd())
542 try:
543 for m in modules:
544 fname = m + '.py'
545 with open(fname, 'w', encoding="utf-8") as f:
546 f.write(textwrap.dedent(modules[m]))
547 linecache.checkcache(fname)
548 importlib.invalidate_caches()
549 yield
550 finally:
551 for m in modules:
552 import_helper.forget(m)
553 sys.path.pop()
554
555def break_in_func(funcname, fname=__file__, temporary=False, cond=None):
556 return 'break', (fname, None, temporary, cond, funcname)

Callers 15

run_testFunction · 0.70
test_next_over_importMethod · 0.70
test_skipMethod · 0.70
test_temporary_bpMethod · 0.70
test_bp_conditionMethod · 0.70
test_bp_ignore_countMethod · 0.70
test_runeval_stepMethod · 0.70

Calls 7

openFunction · 0.50
appendMethod · 0.45
writeMethod · 0.45
dedentMethod · 0.45
invalidate_cachesMethod · 0.45
forgetMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…