xref: /dpdk/dts/framework/remote_session/python_shell.py (revision e9fd1ebf981f361844aea9ec94e17f4bda5e1479)
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 = self.tg_node.create_interactive_shell(
10        PythonShell, timeout=5, privileged=True
11    )
12    python_shell.send_command("print('Hello World')")
13    python_shell.close()
14"""
15
16from pathlib import PurePath
17from typing import ClassVar
18
19from .interactive_shell import InteractiveShell
20
21
22class PythonShell(InteractiveShell):
23    """Python interactive shell."""
24
25    #: Python's prompt.
26    _default_prompt: ClassVar[str] = ">>>"
27
28    #: This forces the prompt to appear after sending a command.
29    _command_extra_chars: ClassVar[str] = "\n"
30
31    #: The Python executable.
32    path: ClassVar[PurePath] = PurePath("python3")
33