All Projects → mintel → pytest-localstack

mintel / pytest-localstack

Licence: MIT license
Pytest plugin for local AWS integration tests

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to pytest-localstack

pytest-djangoapp
Nice pytest plugin to help you with Django pluggable application testing.
Stars: ✭ 35 (-46.97%)
Mutual labels:  pytest, testing-tools, pytest-plugin
pytest-docker-tools
Opionated helpers for creating py.test fixtures for Docker integration and smoke testing environments
Stars: ✭ 61 (-7.58%)
Mutual labels:  pytest, pytest-plugin
pytest-pycodestyle
pytest plugin to run pycodestyle
Stars: ✭ 15 (-77.27%)
Mutual labels:  pytest, pytest-plugin
pytest-datafixtures
Data fixtures for pytest made simple
Stars: ✭ 24 (-63.64%)
Mutual labels:  pytest, pytest-plugin
pytest-involve
A pytest plugin to run tests pertaining to a specific file or changeset
Stars: ✭ 28 (-57.58%)
Mutual labels:  pytest, pytest-plugin
pytest-dependency
Manage dependencies of tests
Stars: ✭ 113 (+71.21%)
Mutual labels:  pytest, pytest-plugin
pytest-csv
CSV reporter for pytest.
Stars: ✭ 16 (-75.76%)
Mutual labels:  pytest, pytest-plugin
pytest-neo
Matrix has you...
Stars: ✭ 44 (-33.33%)
Mutual labels:  pytest, pytest-plugin
pytest-test-groups
A Pytest plugin that gives you a way to split your tests into groups of a specific size
Stars: ✭ 37 (-43.94%)
Mutual labels:  pytest, pytest-plugin
pytest-pipeline
Pytest plugin for functional testing of data analysis pipelines
Stars: ✭ 19 (-71.21%)
Mutual labels:  pytest, pytest-plugin
pytest-snail
Plugin for adding a marker to slow running tests. 🐌
Stars: ✭ 15 (-77.27%)
Mutual labels:  pytest, pytest-plugin
playwright-pytest
Pytest plugin to write end-to-end browser tests with Playwright.
Stars: ✭ 214 (+224.24%)
Mutual labels:  testing-tools, pytest-plugin
pytest-datafiles
pytest plugin to create a tmpdir containing a preconfigured set of files and/or directories.
Stars: ✭ 75 (+13.64%)
Mutual labels:  pytest, pytest-plugin
pytest-eth
PyTest plugin for testing smart contracts for Ethereum blockchain.
Stars: ✭ 23 (-65.15%)
Mutual labels:  pytest, pytest-plugin
overhave
Web-framework for BDD: scalable, configurable, easy to use, based on Flask Admin and Pydantic.
Stars: ✭ 61 (-7.58%)
Mutual labels:  pytest, pytest-plugin
pytest-subprocess
Pytest plugin to fake subprocess.
Stars: ✭ 83 (+25.76%)
Mutual labels:  pytest, pytest-plugin
pytest-watcher
Rerun pytest when your code changes
Stars: ✭ 60 (-9.09%)
Mutual labels:  pytest, testing-tools
Pudb
Full-screen console debugger for Python
Stars: ✭ 2,267 (+3334.85%)
Mutual labels:  pytest, pytest-plugin
Seleniumbase
A Python framework that inspires developers to become better test automation engineers. 🧠💡
Stars: ✭ 2,520 (+3718.18%)
Mutual labels:  pytest, pytest-plugin
pytest-elk-reporter
A plugin to send pytest test results to ELK stack
Stars: ✭ 17 (-74.24%)
Mutual labels:  pytest, pytest-plugin

pytest-localstack

PyPI Travis-CI Codecov

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

Read The Docs

Requires:

  • pytest >= 3.3.0
  • Docker

Tested against Python >= 3.6.

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].