pytest-embedded-qemu is a plugin for the pytest-embedded framework that enables running embedded tests on QEMU instead of actual hardware targets. It extends pytest-embedded with QEMU-specific functionalities, allowing for automated creation of QEMU bootable images and handling device output. It is currently at version 2.7.0 and is actively maintained with a regular release cadence as part of the broader `pytest-embedded` ecosystem by Espressif Systems.
pip install pytest-embedded-qemuVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic test using the `dut` fixture provided by `pytest-embedded`, configured to interact with a QEMU instance. To run this test, save it as a Python file (e.g., `test_qemu.py`) and execute `pytest --embedded-services qemu` in your terminal. You will also need a QEMU-compatible application to run in the simulated environment.
Upgrade your Python environment to 3.10 or newer.
Refer to the pytest-embedded 2.x migration guide for detailed instructions on updating your test code.
Ensure `pytest-embedded-serial-esp` is installed: `pip install pytest-embedded-serial-esp`.
Use QEMU version 8.0 or newer for larger flash images, or configure your application to fit within a 4MB flash size for older QEMU versions.
Install the `pytest-embedded` package: `pip install pytest-embedded`.
Install `pytest-embedded-serial-esp`: `pip install pytest-embedded-serial-esp`.
Install QEMU on your system (e.g., `sudo apt install qemu-system-xtensa` on Debian/Ubuntu, or follow QEMU's official installation guide) and ensure the QEMU executable (e.g., `qemu-system-xtensa`) is included in your system's PATH environment variable.