Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add predicate to EventCatcher test util #10482

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

MichelleArk
Copy link
Contributor

Resolves # N/A

Problem

The EventCatcher module is great for catching specific event types and ensuring they were fired during execution. However, if you want to ensure that specific instantiations of that event type were fired, the mechanism is not flexible enough

Solution

Add an optional predicate field to EventCatcher. It should be a callable that accepts an EventMsg and returns a boolean so we can do more flexible event catching (e.g. predicate=lambda event: event.data.something == "something!")

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • [ x This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@MichelleArk MichelleArk added the Skip Changelog Skips GHA to check for changelog file label Jul 23, 2024
@MichelleArk MichelleArk requested a review from a team as a code owner July 23, 2024 21:37
@cla-bot cla-bot bot added the cla:yes label Jul 23, 2024
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.80%. Comparing base (229c537) to head (a23cbba).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10482      +/-   ##
==========================================
- Coverage   88.85%   88.80%   -0.05%     
==========================================
  Files         180      180              
  Lines       22573    22573              
==========================================
- Hits        20058    20047      -11     
- Misses       2515     2526      +11     
Flag Coverage Δ
integration 86.02% <ø> (-0.12%) ⬇️
unit 62.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.22% <ø> (ø)
Integration Tests 86.02% <ø> (-0.12%) ⬇️

Copy link
Contributor

@QMalcolm QMalcolm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Niceeeeee

@MichelleArk MichelleArk merged commit cd90d44 into main Jul 23, 2024
68 of 69 checks passed
@MichelleArk MichelleArk deleted the add-predicate-to-event-catcher-util branch July 23, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants