Metadata-Version: 2.4
Name: pytest-embedded-serial
Version: 2.11.1
Summary: Make pytest-embedded plugin work with Serial.
Author-email: Fu Hanxi <fuhanxi@espressif.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Testing
License-File: LICENSE
Requires-Dist: pytest-embedded~=2.11.1
Requires-Dist: pyserial~=3.0
Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
Project-URL: homepage, https://github.com/espressif/pytest-embedded
Project-URL: repository, https://github.com/espressif/pytest-embedded

### pytest-embedded-serial

A `pytest-embedded` service for interacting with target hardware over serial (UART) ports.

#### Service Activation

Activate this service by passing `serial` to `--embedded-services`:

```shell
pytest --embedded-services serial --port /dev/ttyUSB0
```

#### Extra Functionalities

- **`serial` Fixture**: Provides a `Serial` object that manages port connection, reading, and writing.
- **`dut` Integration**: Automatically streams all incoming serial output to the `dut` and `pexpect_proc` fixtures for pattern matching.
- **Port Matching**: Select serial ports by device path or USB bus location.

#### CLI Options

- `--port`: Path to the serial port (e.g. `/dev/ttyUSB0`, `COM3`). Default: `None`.
- `--port-location`: USB device location string (format: `<bus>-<port>[-<port>]...`) to match dynamic port paths.
- `--baud`: Serial communication baud rate. Default: `115200`.

#### Quick Example

```python
from pytest_embedded import Dut


def test_serial_echo(dut: Dut):
    dut.write(b'ping\r\n')
    dut.expect('pong')
```

