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.0.2.tar.gz
(2.6 kB
view details)
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 moto_testkit-0.0.2.tar.gz.
File metadata
- Download URL: moto_testkit-0.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1838c340af99c2243358febcc391d6f7fcb4599e01bfc9458fcd835e79da273a
|
|
| MD5 |
d5aba0329fb575a017f0b898c1139877
|
|
| BLAKE2b-256 |
dd8f1a118343efaf8e0a52bd6af8de880075c0dc624da5017462a4ca7b8b4bd9
|
File details
Details for the file moto_testkit-0.0.2-py3-none-any.whl.
File metadata
- Download URL: moto_testkit-0.0.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a53675ff330169c56b8b622ffc9b10ccbbdade06f7da32a25cfc2c398f1fee79
|
|
| MD5 |
fcc45f81cf4cd0b704248ec4bc968ba7
|
|
| BLAKE2b-256 |
bed3211a92d42a35e94a9ccbeec8fda97ded8b4b1052dca680dfd37c46e30969
|