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.3.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.3-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moto_testkit-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 25f3314b2dfe968748cc6c660fe80392887b0f7072f84e4a0730c8cfb59c28d1
MD5 1430811dfcf8ef933d5cd066bd0c3c83
BLAKE2b-256 245be81d40b6fad1c6d8e5426fa87cbff783654d66d23b59d1c82276516a4daf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moto_testkit-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19ead3c9f2945bb81449f3dec2f4e08aae7f811a7d002114cb2d40b88c2d8e5e
MD5 4f6552c1d71d548cf32c123988075fa2
BLAKE2b-256 9a303613d3b9ef6b48f839812d6940b9a66ed460e55b20445e54a12adb633427

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