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

Method run_pdb_script

Lib/test/test_pdb.py:3559–3582  ·  view source on GitHub ↗

Run 'script' lines with pdb and the pdb 'commands'.

(self, script, commands,
                       expected_returncode=0,
                       extra_env=None,
                       script_args=None,
                       pdbrc=None,
                       remove_home=False)

Source from the content-addressed store, hash-verified

3557 return stdout, stderr
3558
3559 def run_pdb_script(self, script, commands,
3560 expected_returncode=0,
3561 extra_env=None,
3562 script_args=None,
3563 pdbrc=None,
3564 remove_home=False):
3565 """Run 'script' lines with pdb and the pdb 'commands'."""
3566 filename = 'main.py'
3567 with open(filename, 'w') as f:
3568 f.write(textwrap.dedent(script))
3569
3570 if pdbrc is not None:
3571 with open('.pdbrc', 'w') as f:
3572 f.write(textwrap.dedent(pdbrc))
3573 self.addCleanup(os_helper.unlink, '.pdbrc')
3574 self.addCleanup(os_helper.unlink, filename)
3575
3576 with os_helper.EnvironmentVarGuard() as env:
3577 if remove_home:
3578 env.unset('HOME')
3579 if script_args is None:
3580 script_args = []
3581 stdout, stderr = self._run_pdb([filename] + script_args, commands, expected_returncode, extra_env)
3582 return stdout, stderr
3583
3584 def run_pdb_module(self, script, commands):
3585 """Runs the script code as part of a module"""

Callers 15

test_specMethod · 0.95
test_issue46434Method · 0.95
test_issue13183Method · 0.95
test_issue16180Method · 0.95
test_issue84583Method · 0.95
test_issue26053Method · 0.95
test_issue58956Method · 0.95
test_pdbrc_basicMethod · 0.95
test_pdbrc_empty_lineMethod · 0.95
test_pdbrc_aliasMethod · 0.95
test_pdbrc_semicolonMethod · 0.95

Calls 6

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

Tested by

no test coverage detected