How can I testing python runtime lambda function?

I’m using serverless framework with python runtime. And I need to unit test. But I don’t know that what should I do…

Is there docs or plugin for python runtime function unit test?

hey did you get anything ?

Did you guys got anything related to unit testing?

I have recently wrote a code in Python using Serverless framework. Now, I am wondering how to write unit tests for that. Any example would be appreciated.

Has anyone found a way to do this yet?

So far I have decided to create a python package, I will unit test myself prior to deployment I think I will use the nose package to help me do this . But I am unable to find a way to test the endpoints yet, I have seen a post about using Mocha to test node endpoints but nothing for python.

[Edit] - I figured out how to test python lambda functions, and wrote a post about it:

I also made that part of a series on how to make a production-ready setup for AWS Lambda functions:

Original Post:

I am currently exploring this.

Will post with more if/when i find it

1 Like


Thanks for your updating. Both blogs are great.

I just tested with the first one, placebo, nice tool, which I should know before. I deal with a lot of boto3 codes. I can use placebo not only for serverless and lambda, but also for other projects using boto3.

I will continues to test the rest tools in the url you mentioned.

Thanks again.