Metadata-Version: 2.4
Name: pytest-embedded-idf
Version: 2.10.2
Summary: Make pytest-embedded plugin work with ESP-IDF.
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.10.2
Requires-Dist: esp-idf-panic-decoder
Requires-Dist: esp-bool-parser>=0.1.2,<1
Requires-Dist: pytest-embedded-serial-esp~=2.10.2 ; extra == "serial"
Requires-Dist: esp-coredump~=1.0 ; extra == "serial"
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
Provides-Extra: serial

### pytest-embedded-idf

A `pytest-embedded` service tailored for [ESP-IDF](https://github.com/espressif/esp-idf) applications and test workflows.

#### Service Activation

Activate this service by passing `idf` to `--embedded-services`. Typically used together with `esp` for physical hardware testing:

```shell
pytest --embedded-services esp,idf --app-path /path/to/esp-idf-app
```

#### Extra Functionalities

- **App Metadata Parsing**: Reads `project_description.json` and build artifacts to identify the target chip, flash settings, partition tables, and binary paths.
- **Smart Flashing & Caching**: Automatically flashes the bootloader, partition table, and application. Caches binary hashes across the session to skip redundant flashing.
- **Panic & Core Dump Decoding**: Automatically parses and decodes panic stack traces and core dumps from target flash/UART when a test fails.
- **Partition Table & NVS Controls**: Erase NVS blocks or customize the partition tool script.
- **Unity Test Runner**: Integrated support for Unity C test suites via `dut.expect_unity_test_output()` and the `case_tester` fixture for test menu navigation.
- **Linux Target Support**: Includes `LinuxDut` and `LinuxSerial` to test ESP-IDF POSIX/Linux applications directly on the host machine.
- **Dynamic Parametrization**: Provides `idf_parametrize` to expand `supported_targets` and filter chips by SoC capability strings.

#### CLI Options

- `--supported-targets`: Comma-separated list of officially supported targets for the test. Default: `None`.
- `--preview-targets`: Comma-separated list of preview/experimental targets for the test. Default: `None`.
- `--part-tool`: Path to the partition table generator script. Default: `$IDF_PATH/components/partition_table/gen_esp32part.py`.
- `--confirm-target-elf-sha256`: Verify ELF SHA256 against target flash before skipping re-flashing. Default: `False`.
- `--erase-nvs`: Erase NVS partition blocks when flashing binaries. Default: `False`.
- `--skip-check-coredump`: Skip auto-checking for core dumps and panic traces on test failure. Default: `False`.

#### Quick Example

```python
from pytest_embedded import Dut


def test_idf_app(dut: Dut):
    # App information is parsed automatically from the ESP-IDF build directory
    print(f'Running target: {dut.app.target}')
    dut.expect('Booting ESP-IDF app...')
    dut.expect('Hello world!')
```

