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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for moto_testkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a5ab2bed72e8a46e074e0c2f80a67370f4a5bcf3c5a445653fb4d79aac14eaa5
MD5 863cf6eb12f34387ec3cc2d422f14ae0
BLAKE2b-256 613911295824afb3d53302f53e81639fa102553d5b9e2f61c3cb7825ed4b5038

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moto_testkit-0.1.0-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.10

File hashes

Hashes for moto_testkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71c29016c9f8d776a91510a62149a84d30f04e3318f623f1a0cbe151c2c12cc4
MD5 09fedc30c7a9c4ef701851f35b5dd55b
BLAKE2b-256 742b9cb95f0b8011a9819fa5e8d4ed91761c7ef1e2d6a730c1c0e4c6d78930cd

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