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: Repository URL fixed
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file localstack-utils-1.0.1.tar.gz.
File metadata
- Download URL: localstack-utils-1.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
142dff0b6cb334f917e94587554e96681395115ac77192b5310e260447929b0d
|
|
| MD5 |
4d80be042bef888ee8a0e188bd0ca057
|
|
| BLAKE2b-256 |
a12b4b6ab3c622edb73cc28f143c09f7c6327fcf48a7cb1df6900775da70847f
|
File details
Details for the file localstack_utils-1.0.1-py3-none-any.whl.
File metadata
- Download URL: localstack_utils-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277efb5f0830159f7a433f4daf028a9453805535523d98dff4b5f0d9cd97629e
|
|
| MD5 |
0cef805fc72de4cab450dabf55bcb8e3
|
|
| BLAKE2b-256 |
ed7158c923dde9913c2a90bd2cb11a6ccc12efb021d56ae1a5566d901ae0af9e
|