Spawn a new Python interpreter, pass the given input source code from the stdin and return the result back. If the interpreter exits non-zero, it raises a ValueError.
(self, source)
| 6607 | **kw) |
| 6608 | |
| 6609 | def run_on_interactive_mode(self, source): |
| 6610 | """Spawn a new Python interpreter, pass the given |
| 6611 | input source code from the stdin and return the |
| 6612 | result back. If the interpreter exits non-zero, it |
| 6613 | raises a ValueError.""" |
| 6614 | |
| 6615 | process = self.spawn_repl() |
| 6616 | process.stdin.write(source) |
| 6617 | output = kill_python(process) |
| 6618 | |
| 6619 | if process.returncode != 0: |
| 6620 | raise ValueError("Process didn't exit properly.") |
| 6621 | return output |
| 6622 | |
| 6623 | @unittest.skipIf(not has_subprocess_support, "test requires subprocess") |
| 6624 | def test_getsource(self): |
no test coverage detected