-
Notifications
You must be signed in to change notification settings - Fork 421
New testing utility #1169
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
Comments
@heitorlessa any progress on this or volunteers. It would be nice to have a seperately package for this to help Powertools users as well as internal. |
Might also be nice to have built in features for mocking the |
Hey Noah, could you give an example of the experience you’re after?
Tracer automatically disabled I/O during unit testing, so no changes
needed. Logger needs a fake Lambda context (we have on our docs). Metrics
only needs a fake Lambda context when capturing cold start.
While we document how to test each feature, I’m super keen to hear how we
can make that easier.
Thank you ;-)
…On Wed, 1 Jun 2022 at 20:41, Noah ***@***.***> wrote:
Might also be nice to have built in features for mocking the logger,
metrics, and tracer decorators.
—
Reply to this email directly, view it on GitHub
<#1169 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBEM26DJEXX77MPXYLLVM6VFDANCNFSM5URK3YAQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This is needed and very useful. Almost need a separate project that harvests Lambda events from real AWS infrastructure and uses these "events" to generate data classes - this sounds so simple as I type it 😬. Also need to split out much of the test components within the main repo - it is reusable. Would save people from taking parts and adapting them to their needs (like I have done here). |
We're closing feature requests older than a year that haven't received enough customers +1 or that we were unable to prioritize. For newer customers interested in, please feel free to comment and we can reopen it. On Testing, this is something we won't be able to do this year. If a newer customer sees this in 2024, please feel free to comment and we can revisit it |
|
Runtime: Python
Is your feature request related to a problem? Please describe
As per this discussion, creating test events for Lambda event sources is a laborious process.
Finding the correct event with default values tend to be 1/ invoking a Lambda function, 2/ logging the event, 3/ extracting the log event from CloudWatch, 4/ serializing back to native Python object, 5/ creating a Pytest fixture that can be used across tests.
This cycle repeats when you're trying to mock Lambda Context for libraries and middlewares that make use of it.
Describe the solution you'd like
Make tests events available in the project as Dataclasses that can be initialized with default values and changed as we see please.
Describe alternatives you've considered
Create my own default Lambda Context using LambdaContext typing
If you provide guidance, is this something you'd like to contribute?
Additional context
The text was updated successfully, but these errors were encountered: