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

Method run_pdb_module

Lib/test/test_pdb.py:3584–3596  ·  view source on GitHub ↗

Runs the script code as part of a module

(self, script, commands)

Source from the content-addressed store, hash-verified

3582 return stdout, stderr
3583
3584 def run_pdb_module(self, script, commands):
3585 """Runs the script code as part of a module"""
3586 self.module_name = 't_main'
3587 os_helper.rmtree(self.module_name)
3588 main_file = self.module_name + '/__main__.py'
3589 init_file = self.module_name + '/__init__.py'
3590 os.mkdir(self.module_name)
3591 with open(init_file, 'w') as f:
3592 pass
3593 with open(main_file, 'w') as f:
3594 f.write(textwrap.dedent(script))
3595 self.addCleanup(os_helper.rmtree, self.module_name)
3596 return self._run_pdb(['-m', self.module_name], commands)
3597
3598 def _assert_find_function(self, file_content, func_name, expected):
3599 with open(os_helper.TESTFN, 'wb') as f:

Callers 5

test_run_moduleMethod · 0.95
test_breakpointMethod · 0.95
test_empty_fileMethod · 0.95

Calls 6

_run_pdbMethod · 0.95
addCleanupMethod · 0.80
openFunction · 0.50
mkdirMethod · 0.45
writeMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected