pytest-embedded-serial

class pytest_embedded_serial.dut.SerialDut(*args, **kwargs)

Bases: Dut

Dut class for serial ports

serial

Serial instance

Type:

Serial

openocd

OpenOcd instance, applied only when jtag service is activated

Type:

OpenOcd

gdb

Gdb instance, applied only when jtag service is activated

Type:

Gdb

telnet

Telnet instance, applied only when jtag service is activated

Type:

Telnet

setup_jtag()
write(data: AnyStr) None

Write to the MessageQueue instance

class pytest_embedded_serial.serial.Serial(msg_queue: MessageQueue, port: Optional[str] = None, port_location: Optional[str] = None, baud: int = 115200, meta: Optional[Meta] = None, stop_after_init: bool = False, ports_to_occupy: List[str] = (), **kwargs)

Bases: object

Custom serial class

port

port address

Type:

str

baud

baud rate

Type:

int

proc

process created by serial.serial_for_url()

Type:

pyserial.Serial

Warning

  • make sure this Serial.__init__() run the last in MRO, it would create and start the redirect serial process

DEFAULT_BAUDRATE = 115200
DEFAULT_PORT_CONFIG: ClassVar[Dict[str, Any]] = {'baudrate': 115200, 'bytesize': 8, 'parity': 'N', 'rtscts': False, 'stopbits': 1, 'timeout': 0.05, 'xonxoff': False}
close()
disable_redirect_thread() bool

kill the redirect thread, and start a new one after got yield back

Yields:

True if redirect serial thread has been terminated

occupied_ports: ClassVar[Dict[str, None]] = {}
start_redirect_thread() None
stop_redirect_thread() bool