xref: /dpdk/dts/framework/remote_session/python_shell.py (revision bfad0948df75e95e04cba1804a2749cfc91c56fb)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2023 PANTHEON.tech s.r.o.
3
4"""Python interactive shell.
5
6Typical usage example in a TestSuite::
7
8    from framework.remote_session import PythonShell
9    python_shell = PythonShell(self.tg_node, timeout=5, privileged=True)
10    python_shell.send_command("print('Hello World')")
11    python_shell.close()
12"""
13
14from pathlib import PurePath
15from typing import ClassVar
16
17from .interactive_shell import InteractiveShell
18
19
20class PythonShell(InteractiveShell):
21    """Python interactive shell."""
22
23    #: Python's prompt.
24    _default_prompt: ClassVar[str] = ">>>"
25
26    #: This forces the prompt to appear after sending a command.
27    _command_extra_chars: ClassVar[str] = "\n"
28
29    #: The Python executable.
30    path: ClassVar[PurePath] = PurePath("python3")
31