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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.400s · 31.9MB
glibcpy 3.10–3.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)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_embedded'
Package not installed or installed in wrong environment.
fixRun `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.
fixUpgrade 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.
fixEnsure `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