Python test fixtures for your local AWS cloud stack
Project description
boto3-fixtures
boto3-fixtures provides test fixtures for your local AWS cloud stack.
Testing software which touches cloud infrastructure doesn't have to be difficult! boto3-fixtures
provides a dead-simple framework for setup+teardown of mocked AWS infrastructure. Use in combination with projects like moto or localstack.
Supports
- Kinesis
- SQS
- S3
- Lambda
- DynamoDB
Getting Started
This library provides a context decorator, boto3_fixtures.Service
, which will setup and teardown AWS services.
from boto3_fixtures import Service
with Service("kinesis", ["my-kinesis-stream"]) as streams:
# Streams exist
# Streams are destroyed
Combine this with a local testing stack of your choice (moto, localstack).
import boto3, boto3_fixtures, moto
def test_my_code():
with moto.mock_sqs():
with boto3_fixtures.Service("sqs", names=["first-queue", "second-queue"]) as queues:
client = boto3.client("sqs")
response = client.list_queues()
assert len(response["QueueUrls"]) == 2
You can create pytest fixtures to simplify this even further.
import pytest, boto3_fixtures, moto
@pytest.fixture
def sqs_queues():
return ["first-queue", "second-queue"]
@pytest.fixture
def sqs(sqs_queues):
with moto.mock_sqs():
with boto3_fixtures.Service("sqs", names=["first-queue", "second-queue"]) as queues:
yield queues
@pytest.mark.usefixtures("sqs")
def test_my_code():
# Queues exist for the duration of this test (or whatever scope you set on the fixture)
pass
WIP
- Tons more examples
pytest
plugin/fixtures- More AWS services!
Please submit a PR or issue if you'd like to see support for a specific AWS service!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file boto3-fixtures-0.0.4b1.tar.gz
.
File metadata
- Download URL: boto3-fixtures-0.0.4b1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51f2e0ff72a4fbe49749ab98b2cc62684b9c3aea47bc0181862f94b755be0a7d |
|
MD5 | 686dac85fcdf4286357b3f58e23811cf |
|
BLAKE2b-256 | 1ad9c553b353d17a1231b204ddd1399b8519d56d71fe3b6a3091dbbfd48dc96d |
File details
Details for the file boto3_fixtures-0.0.4b1-py2.py3-none-any.whl
.
File metadata
- Download URL: boto3_fixtures-0.0.4b1-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c83ddb8ce44a1eefce5c76598fd20416953942161d518e65bfe72b280fbd6f4d |
|
MD5 | 98a0bac081535c8f80e69906255e01a2 |
|
BLAKE2b-256 | 435afe6b6272a08ff769c56869c7eb04c23f7a58dc838ef6b2f710a2806f4e7f |