Runs the script code as part of a module
(self, script, commands)
| 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: |
no test coverage detected