Registry / testing / pytest-embedded

pytest-embedded

JSON →
library2.8.1pypypi✓ verified 87d ago

A pytest plugin designed for embedded system testing. Current version 2.7.0 provides fixtures and utilities for testing firmware on microcontrollers and SoCs, with support for serial, jtag, and qemu backends. Release cadence is irregular, with recent updates focused on compatibility with pytest 8+.

pip install pytest-embedded
INSTALL
IMPORT
SIG · PYTEST-EMBEDDED
P
pytest-embedded
testingpythonv2.8.1
Install
2.9s avg
Import
376ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.400s · 31.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.9s · import 0.353s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_embedded
import pytest_embedded
from embedded import pytest_embedded
Import directly; no subpackage needed.

Basic example with DUT fixture. Requires conftest.py defining pytest_embedded_config.

import pytest import os # conftest.py def pytest_embedded_config(): return { 'app': os.environ.get('APP_PATH', '.'), 'port': os.environ.get('TARGET_PORT', '/dev/ttyUSB0'), 'target': os.environ.get('TARGET', 'esp32'), } # test_example.py def test_basic(dut): dut.expect('Hello from firmware') dut.write('test_cmd') dut.expect('ok', timeout=5)
Debug
Known issues
breakingIn v2.x, the config function must be named `pytest_embedded_config`, not `pytest_embedded_conf` as in v1.x.
fix
Rename to `pytest_embedded_config`.
affects: >=2.0.0
deprecatedThe `--embedded-boards` CLI option is deprecated in favor of `--target`.
fix
Use `--target` instead.
affects: >=1.5.0 <=2.5.0
gotchaIf you use `pexpect` directly on the DUT, it may conflict with the internal serial handling; use `dut.write()` and `dut.expect()` methods.
fix
Use the DUT fixture's read/write methods instead of raw pexpect.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_embedded'
Package not installed or installed in wrong environment.
fix
Run `pip install pytest-embedded` in the correct virtual environment.
AttributeError: 'Dut' object has no attribute 'expect'
Using v1.x API where DUT has different method names.
fix
Upgrade to v2.x: `pip install 'pytest-embedded>=2'` and use `dut.expect()`.
TypeError: pytest_embedded_config() missing 1 required positional argument: 'app'
Config function not returning a dictionary as expected.
fix
Ensure `pytest_embedded_config` returns a dict with required keys (app, port, target).
Upgrade
Version history
2.8.1latest on PyPI · released Jun 16, 2026
Audit
Dependencies
pytestrequiredRequired: pytest plugin
pyserialoptionalSerial backend
pyelftoolsoptionalELF parsing for firmware
Agent activity
12 hits · last 30 days
node
12
Resources
pytest-embedded — pip install pytest-embedded · libregistry