Skip to main content

pytest-localstack

PyPI Travis-CI Codecov https://img.shields.io/github/license/mintel/pytest-localstack.svg https://img.shields.io/github/issues/mintel/pytest-localstack.svg https://img.shields.io/github/forks/mintel/pytest-localstack.svg https://img.shields.io/github/stars/mintel/pytest-localstack.svg

pytest-localstack is a plugin for pytest to create AWS integration tests via a Localstack Docker container.

Read The Docs

Requires:

  • pytest >= 7

  • Docker

Tested against Python >= 3.10.

Features

  • Create pytest fixtures that start and stop a Localstack container.

  • Temporarily patch botocore to redirect botocore/boto3 API calls to Localstack container.

  • Plugin system to easily extend supports to other AWS client libraries such as aiobotocore.

Example

import boto3
import pytest_localstack

localstack = pytest_localstack.patch_fixture(
    services=["s3"],  # Limit to the AWS services you need.
    scope='module',  # Use the same Localstack container for all tests in this module.
    autouse=True,  # Automatically use this fixture in tests.
)

def test_s3_bucket_creation():
    s3 = boto3.resource('s3')  # Botocore/boto3 will be patched to use Localstack
    assert len(list(s3.buckets.all())) == 0
    bucket = s3.Bucket('foobar')
    bucket.create()
    assert len(list(s3.buckets.all())) == 1

Services

  • apigateway

  • cloudformation

  • cloudwatch

  • dynamodb

  • dynamodbstreams

  • ec2

  • es

  • firehose

  • iam

  • kinesis

  • lambda

  • logs

  • redshift

  • route53

  • s3

  • secretsmanager

  • ses

  • sns

  • sqs

  • ssm

  • stepfunctions

  • sts

Installation

$ pip install pytest-localstack

TODO

  • More detailed docs.

  • Break Docker container running out of LocalstackSession.

  • Make botocore patching more comprehensible.

  • Add common test resource fixture factories i.e. S3 buckets, SQS queues, SNS topics, etc.

  • Test this works for non-localhost Docker containers.

  • Add other client libraries such as aiobotocore.

Metadata

Release files for pytest-localstack 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-localstack 0.8.0
File Size Uploaded Provenance Actions
pytest_localstack-0.8.0.tar.gz 19.7 kB With provenance Details for pytest_localstack-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-localstack 0.8.0
File Interpreter ABI Platform Actions
pytest_localstack-0.8.0-py3-none-any.whl Python 3 none any Details for pytest_localstack-0.8.0-py3-none-any.whl

Total release size: 43.4 kB

Release files / pytest_localstack-0.8.0.tar.gz

Download URL pytest_localstack-0.8.0.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7f1104d310b8e0c4f8d8ce203022c9a0190063abee9d606a1b329bb9e7a5a2f7
BLAKE2b-256 checksum
How to use checksums
a21850329fdae543af4c8edf6046e3de1528ca4bf4f3fdee3711d52ad140b687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / pytest_localstack-0.8.0-py3-none-any.whl

Download URL pytest_localstack-0.8.0-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3226778a6d258d433b99346ec87398979d7855da74567c2fcbaa0a5f9810f969
BLAKE2b-256 checksum
How to use checksums
40f3a619a6cc61801618060d5df3d982d8a39afeefbd12558d9a40becb8b4dd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Security for pytest-localstack 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytest_localstack-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page