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

Method run_repl

Lib/test/test_pyrepl/test_pyrepl.py:73–100  ·  view source on GitHub ↗
(
        self,
        repl_input: str | list[str],
        env: dict | None = None,
        *,
        cmdline_args: list[str] | None = None,
        cwd: str | None = None,
        skip: bool = False,
        timeout: float = SHORT_TIMEOUT,
        exit_on_output: str | None = None,
    )

Source from the content-addressed store, hash-verified

71 raise SkipTest("test module requires subprocess")
72
73 def run_repl(
74 self,
75 repl_input: str | list[str],
76 env: dict | None = None,
77 *,
78 cmdline_args: list[str] | None = None,
79 cwd: str | None = None,
80 skip: bool = False,
81 timeout: float = SHORT_TIMEOUT,
82 exit_on_output: str | None = None,
83 ) -> tuple[str, int]:
84 temp_dir = None
85 if cwd is None:
86 temp_dir = tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
87 cwd = temp_dir.name
88 try:
89 return self._run_repl(
90 repl_input,
91 env=env,
92 cmdline_args=cmdline_args,
93 cwd=cwd,
94 skip=skip,
95 timeout=timeout,
96 exit_on_output=exit_on_output,
97 )
98 finally:
99 if temp_dir is not None:
100 temp_dir.cleanup()
101
102 def _run_repl(
103 self,

Calls 2

_run_replMethod · 0.95
cleanupMethod · 0.95

Tested by

no test coverage detected