Skip to content

feat: Add group class for better control of multi dut tests#415

Open
lucasssvaz wants to merge 2 commits intoespressif:mainfrom
lucasssvaz:feat/group
Open

feat: Add group class for better control of multi dut tests#415
lucasssvaz wants to merge 2 commits intoespressif:mainfrom
lucasssvaz:feat/group

Conversation

@lucasssvaz
Copy link
Copy Markdown
Member

Description

This pull request introduces multi-DUT (Device Under Test) synchronization support to the pytest-embedded framework, allowing users to control and coordinate multiple DUTs in parallel within tests. The main addition is the new DutGroup class, which provides a transparent, parallel proxy for running commands and assertions across multiple DUTs. The documentation and tests have been updated to reflect and validate this new functionality.

Key changes:

Multi-DUT Synchronization Feature

  • Added the DutGroup class in pytest_embedded/group.py, providing a container-like proxy to run any Dut method in parallel across multiple DUTs. Special handling is included for expect and expect_exact to support both broadcast and per-DUT patterns, as well as container protocol support (indexing, iteration, etc.). (pytest-embedded/pytest_embedded/group.py)
  • Exposed DutGroup in the main package API and as a class attribute on Dut for discoverability. (pytest-embedded/pytest_embedded/__init__.py, pytest-embedded/pytest_embedded/dut.py) [1] [2] [3]

Documentation Updates

  • Added a new API documentation section for pytest_embedded.group and updated usage documentation to explain multi-DUT synchronization, how to use DutGroup, and its benefits for parallel test execution. (docs/apis/pytest-embedded.rst, docs/usages/expecting.rst) [1] [2] [3]

Testing

  • Introduced comprehensive tests for DutGroup covering container protocol, parallel execution, broadcasting, per-DUT patterns, proxying, multi-phase synchronization, and error handling. (pytest-embedded/tests/test_base.py)

These changes significantly enhance the usability of pytest-embedded for scenarios involving multiple devices, making it easier to write robust, synchronized, and efficient multi-device tests.

Testing

Tested locally

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Title Coverage Tests Skipped Failures Errors Time
3.14 X64 Coverage 104 16 💤 0 ❌ 0 🔥 13m 37s ⏱️
3.10 ARM64 Coverage 104 18 💤 1 ❌ 0 🔥 10m 47s ⏱️
Qemu Coverage 7 0 💤 0 ❌ 0 🔥 24.964s ⏱️

@hfudev
Copy link
Copy Markdown
Member

hfudev commented Apr 13, 2026

@lucasssvaz Thank you for this big improvement. I kinda like this idea. Please ping me again once the CI passed!

@lucasssvaz
Copy link
Copy Markdown
Member Author

lucasssvaz commented Apr 13, 2026

@hfudev Fixed. Looks like the rest of the errors are related to not finding USB ports on the runner.

I had the idea of creating this class while working on tests that require precise synchronization of the devices. Let me know if there is anything you would like me to change or add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants