Skip to main content

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.5: Add support for configurable container name and auth token forwarding
  • 1.0.4: Fixes to LocalStack and Container modules
  • 1.0.3: Add auto_remove config option
  • 1.0.2: LocalStack Pro image set as default
  • 1.0.1: Repository URL fixed
  • 1.0.0: Initial version

Release files for localstack-utils 1.0.5

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

Source distribution (sdist)

Source distribution for localstack-utils 1.0.5
File Size Uploaded
localstack_utils-1.0.5.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for localstack-utils 1.0.5
File Interpreter ABI Platform
localstack_utils-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / localstack_utils-1.0.5.tar.gz

Download URL localstack_utils-1.0.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7e50edc3e29ed7ed253e72adf4b71094b70961b7ed066ccf576db926733e7ee2
BLAKE2b-256 checksum
How to use checksums
9374fbb1f3748b041268cf5dbde2324de7242fb84701474342c8dff25da65a5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / localstack_utils-1.0.5-py3-none-any.whl

Download URL localstack_utils-1.0.5-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af163f061bacb5479e23c82a37901e7d505638903aa86dda319f5a4e86f17f8b
BLAKE2b-256 checksum
How to use checksums
bfec19da6c964a7517c09fa904f4ac2456b604054b57094a84955f14e208a184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.0

2 release files

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