# How can I testing python runtime lambda function?

**URL:** <https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [August 7, 2016, 1:09pm UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86 "2016-08-07T13:09:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![meoooh](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@meoooh](https://forum.serverless.com/u/meoooh)\
**Post date:** [August 7, 2016, 1:09pm UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/1 "2016-08-07T13:09:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anandkarwa](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@anandkarwa](https://forum.serverless.com/u/anandkarwa)\
**Post date:** [December 27, 2016, 7:26am UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/2 "2016-12-27T07:26:00Z")

</div>

hey did you get anything ?

---

<div class="post-metadata">

**Author:** ![pratik](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pratik](https://forum.serverless.com/u/pratik)\
**Post date:** [July 14, 2017, 10:03pm UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/3 "2017-07-14T22:03:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NeuroWinter](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/neurowinter/32/1527_2.png) [@NeuroWinter](https://forum.serverless.com/u/NeuroWinter)\
**Post date:** [January 17, 2018, 10:21pm UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/4 "2018-01-17T22:21:43Z")

</div>

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 [http://pythontesting.net/framework/nose/nose-introduction/](http://pythontesting.net/framework/nose/nose-introduction/) . 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.

---

<div class="post-metadata">

**Author:** ![joshuaballoch](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/joshuaballoch/32/1585_2.png) [@joshuaballoch](https://forum.serverless.com/u/joshuaballoch)\
**Post date:** [February 1, 2018, 6:37pm UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/5 "2018-02-01T18:37:45Z")

</div>

[Edit] - I figured out how to test python lambda functions, and wrote a post about it: [joshuaballoch.github.io/testing-lambda-functions/](http://joshuaballoch.github.io/testing-lambda-functions/)

I also made that part of a series on how to make a production-ready setup for AWS Lambda functions: [joshuaballoch.github.io/production-ready-aws-lambda/](http://joshuaballoch.github.io/production-ready-aws-lambda/)

Original Post:

I am currently exploring this.

Will post with more if/when i find it

---

<div class="post-metadata">

**Author:** ![bill](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bill/32/1072_2.png) [@bill](https://forum.serverless.com/u/bill)\
**Post date:** [March 2, 2018, 3:53am UTC](https://forum.serverless.com/t/how-can-i-testing-python-runtime-lambda-function/86/6 "2018-03-02T03:53:45Z")

</div>

@joshuaballoch

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.
