Defining AWS/boto3 clients and resources outside of functions with unit tests
I am writing some unit tests using pytest
for some functions that are called using AWS Lambda. I am using boto3
to interact with AWS, and I’m mocking using moto
. Where I am using a resource or client from boto3
, I’ve defined them outside of functions as I understand that allows for them to be reused across warm starts.