Mock local resources for serverless framework.
pip install pytest-serverless
What problem it tries to solve?
During writing tests you will have to mock those in moto.
This pytest plugin tries to automate this process by reading
serverless.yml file and create
mocks of resources for you.
Mark your test with
@pytest.mark.usefixtures("serverless"), and rest will be done by plugin.
import boto3 import pytest @pytest.mark.usefixtures("serverless") def test(): table = boto3.resource("dynamodb").Table("my-microservice.my-table") count_of_items = len(table.scan()["Items"]) assert count_of_items == 0
Plugin is in early stage of development, so you might find some bugs or missing functionality.
If possible create pull request (with tests) that fixes particular problem.