feat: Add option to capture payloads#420
Open
lucasssvaz wants to merge 4 commits into
Open
Conversation
be59030 to
49e8d70
Compare
for more information, see https://pre-commit.ci
hfudev
reviewed
May 26, 2026
Member
hfudev
left a comment
There was a problem hiding this comment.
the other parts LGTM. left some comments regarding the listener.
hfudev
reviewed
May 26, 2026
for more information, see https://pre-commit.ci
Member
Author
|
@hfudev Fixed the issues and added tests for these cases as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a robust mechanism for selectively muting stdout echo from the serial listener process in
pytest-embedded, allowing for more controlled and less noisy test output—especially when capturing sensitive or bulk payloads. The changes add both manual (event-based) and automatic (pattern-based) muting, as well as new helper methods for capturing serial payloads, with extensive support for customization via fixtures.Key changes include:
Stdout Echo Muting and Payload Capture Enhancements:
_mute_eventandmute_patternsto enable both manual and automatic suppression of stdout echo in the serial listener process, while still logging all output to file. This is exposed via new fixtures and passed through the test infrastructure. [1] [2] [3] [4]mute_echo,unmute_echo, and amuted_echocontext manager inDutto allow test code to programmatically mute or unmute stdout echo.Automatic Muting with Patterns:
mute_patternsfixture, allowing projects to specify start/end string pairs that automatically trigger muting/unmuting of stdout echo based on serial output content. [1] [2] [3]Serial Payload Capture Utilities:
capture_payloadandcapture_payload_to_filemethods toDutfor extracting delimited payloads from serial output, with optional muting and file persistence.Refactoring and Integration:
_mute_eventandmute_patternsthroughout the test infrastructure, ensuring all components are aware of and can leverage the new muting capabilities. [1] [2] [3] [4]Other:
These changes provide fine-grained control over test output, making it easier to capture and process serial data without cluttering stdout, and enable project-specific customization of muting behavior.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
Testing
Tested locally