aiomoto
raw JSON → 0.3.0 verified Fri May 01 auth: no python
aiomoto provides Moto-style AWS service mocks for aiobotocore/aioboto3, enabling async mocking of AWS services like S3, SES, etc. Current version is 0.3.0, with an active release cadence targeting developers using async AWS SDKs.
pip install aiomoto Common errors
error ModuleNotFoundError: No module named 'aiomoto' ↓
cause aiomoto not installed or installed in wrong environment.
fix
Run 'pip install aiomoto' in your virtual environment.
error AttributeError: module 'aiomoto' has no attribute 'mock_s3' ↓
cause Old version of aiomoto that may not support 'mock_s3' or import path changed.
fix
Update to latest version: 'pip install --upgrade aiomoto' and check imports from aiomoto.
Warnings
breaking Version 0.3.0 introduced a new server-mode attach/registry feature with custom exceptions; existing code using older mock decorators should remain compatible. ↓
fix Review if server-mode changes affect your usage; no breaking changes reported for basic mocking.
deprecated aiomoto requires Python >=3.10; Python 3.9 or older will cause installation failures. ↓
fix Upgrade Python to 3.10 or later.
gotcha Mock decorators must be applied to async functions; applying to sync functions will not work. ↓
fix Ensure the decorated function is defined with 'async def'.
Imports
- AioMoto wrong
from aiomoto.core import AioMotocorrectfrom aiomoto import AioMoto - mock_s3
from aiomoto import mock_s3
Quickstart
import aioboto3
from aiomoto import mock_s3
@mock_s3
async def test_s3_bucket():
session = aioboto3.Session()
async with session.client('s3', region_name='us-east-1') as s3:
await s3.create_bucket(Bucket='mybucket')
response = await s3.list_buckets()
assert 'mybucket' in [b['Name'] for b in response['Buckets']]
import asyncio
asyncio.run(test_s3_bucket())