Skip to main content

An extended testkit for AWS services using moto, with sync/async helpers and examples.

Project description

moto-testkit

moto-testkit is an enhanced testing toolkit built on top of moto, providing:

  • Easy setup for unit tests (Pytest + Unittest).
  • Support for sync and async workflows.
  • Ready-to-use helpers for AWS services.
  • A full examples/ directory with practical test cases.

🚀 Benefits over moto

  • ✅ Simplified setup for both sync & async tests.
  • ✅ Preconfigured decorators and fixtures for Pytest & Unittest.
  • ✅ Rich examples for DynamoDB, S3, and other AWS services.
  • ✅ Helpers for repetitive patterns (table creation, sessions, contexts).

📂 Examples

Check the examples/ folder for:

  • Pytest usage with async/sync.
  • Unittest usage with decorators.
  • Service-specific helpers.
import unittest
from moto_testkit import use_moto_testkit

@use_moto_testkit(auto_start=True)
class TestDynamoDB(unittest.TestCase):
    def setUp(self):
        self.repo.create_table(
            table_name="Users",
            key_schema=[{"AttributeName": "id", "KeyType": "HASH"}],
            attribute_definitions=[{"AttributeName": "id", "AttributeType": "S"}]
        )

    def test_insert_user(self):
        self.repo.put_item(table_name="Users", item={"id": "123", "name": "Alice"})
        result = self.repo.get_item(table_name="Users", key={"id": "123"})
        assert result["Item"]["name"] == "Alice"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moto_testkit-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moto_testkit-0.1.1-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file moto_testkit-0.1.1.tar.gz.

File metadata

  • Download URL: moto_testkit-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for moto_testkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3229f5d65b74b25f5d3eaaa75809835e35ca6120dcf97b54e8a49c60af992e16
MD5 80c123f403fa224134e7ba94d490b5ac
BLAKE2b-256 1233dfaf4734dfdd23c0436de18ea3eeaeda26388f8f29877c1b882e40400ee1

See more details on using hashes here.

File details

Details for the file moto_testkit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: moto_testkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for moto_testkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 288401d249be99f08adff337af7a9da1a44c8bc4397da3108e73212be58f2f06
MD5 e3db116733fe511a2d5b5c640ef6da60
BLAKE2b-256 42f64dd59068500781b3a0130f8a0a997e8d6af4a3b6bebae79c6f5b5f4d2aa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page