Utils for testing with LocalStack
Project description
LOCALSTACK-UTILS
This Python utility streamlines the integration of Localstack, a local AWS cloud services mock, with unit tests. Seamlessly incorporate Localstack into your Python projects to facilitate efficient and reliable testing of AWS interactions within a controlled local environment. Enhance the development process by utilizing this utility to simulate AWS services during unit testing, ensuring robust and dependable code before deployment.
Prerequisites
- Docker
- Localstack
Instalation
pip install localstack-utils
Usage example
import time
import boto3
import unittest
from localstack_utils.localstack import startup_localstack, stop_localstack
class TestKinesis(unittest.TestCase):
def setUp(self):
startup_localstack()
def tearDown(self):
stop_localstack()
return super().tearDown()
def test_create_stream(self):
kinesis = boto3.client(
service_name="kinesis",
aws_access_key_id="test",
aws_secret_access_key="test",
endpoint_url="http://localhost:4566",
)
kinesis.create_stream(StreamName="test", ShardCount=1)
time.sleep(1)
response = kinesis.list_streams()
self.assertGreater(len(response.get("StreamNames", [])), 0)
Change Log
- 1.0.0: Initial version
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
localstack-utils-1.0.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for localstack_utils-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9493e3cb669e647015929c5e07559711c0622c6882ac2fd7b584e9a5f8975cb5 |
|
MD5 | e398b4b403ecae1d19cc04691177210a |
|
BLAKE2b-256 | 0a2aee50fe4087c1a614bb2e319de1b733911aa0d48d2d22ceac10804f5b6af5 |