summaryrefslogtreecommitdiff
path: root/dts/framework/remote_session/python_shell.py
blob: 953ed100dffcdb88e2dc7e16cec680fc293aaf3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2023 PANTHEON.tech s.r.o.

"""Python interactive shell.

Typical usage example in a TestSuite::

    from framework.remote_session import PythonShell
    python_shell = PythonShell(self.tg_node, timeout=5, privileged=True)
    python_shell.send_command("print('Hello World')")
    python_shell.close()
"""

from pathlib import PurePath
from typing import ClassVar

from .interactive_shell import InteractiveShell


class PythonShell(InteractiveShell):
    """Python interactive shell."""

    #: Python's prompt.
    _default_prompt: ClassVar[str] = ">>>"

    #: This forces the prompt to appear after sending a command.
    _command_extra_chars: ClassVar[str] = "\n"

    #: The Python executable.
    path: ClassVar[PurePath] = PurePath("python3")