Skip to main content

wasmo

A stateful AWS mock that runs inside your test process. Write a value to DynamoDB and the next get_item returns it; put an object in S3 and list_objects_v2 shows it. No Docker, no ports, no sidecar process: the AWS emulator is a single WebAssembly module that wasmo hooks into botocore's HTTP layer, so request signing, retries, checksums, and response parsing are boto3's own.

Emulated services: STS, SQS, DynamoDB, S3, SNS, EventBridge, Secrets Manager, SSM Parameter Store, KMS. The same module also backs wasmo's Go, JavaScript, and JVM adapters, so every language sees the same behaviour. Source and service coverage: https://github.com/conao3/wasm-wasmo.

Requires Python 3.10+. The WebAssembly module ships inside the package and runs on wasmtime. It is compiled once per process; each mock gets its own instance.

import boto3
import wasmo

with wasmo.mock_aws() as aws:
    s3 = boto3.client("s3")
    s3.create_bucket(Bucket="assets")
    s3.put_object(Bucket="assets", Key="hello.txt", Body=b"hi")
    assert s3.get_object(Bucket="assets", Key="hello.txt")["Body"].read() == b"hi"

    aws.reset()  # drop all state

Inside mock_aws(), every botocore client and boto3 resource created from any session talks to that mock. A client stays bound to the mock it was created in. Unless you pass them explicitly, wasmo sets the endpoint to http://wasmo.local and the credentials to test / test, and the environment gets AWS_DEFAULT_REGION=us-east-1 and the same dummy credentials for the duration of the block. Leaving the block closes the mock; its clients then raise.

As a decorator, each call runs in a fresh mock:

@wasmo.mock_aws
def test_enqueue():
    sqs = boto3.client("sqs")
    url = sqs.create_queue(QueueName="jobs")["QueueUrl"]
    sqs.send_message(QueueUrl=url, MessageBody="hi")
    assert sqs.receive_message(QueueUrl=url)["Messages"][0]["Body"] == "hi"

A pytest fixture:

import pytest
import wasmo


@pytest.fixture
def aws():
    with wasmo.mock_aws() as aws:
        yield aws


def test_rejects_a_duplicate(aws):
    table = boto3.resource("dynamodb").Table("users")  # create the table first
    put = dict(Item={"id": "1"}, ConditionExpression="attribute_not_exists(id)")
    table.put_item(**put)
    with pytest.raises(table.meta.client.exceptions.ConditionalCheckFailedException):
        table.put_item(**put)

Without patching botocore, wasmo.Mock() hands out bound clients directly:

aws = wasmo.Mock()
ddb = aws.resource("dynamodb")
sqs = aws.client("sqs", region_name="eu-west-1")
session = aws.session()  # a boto3.Session bound to this mock
aws.close()

aws.fetch(url, method="GET", headers=None, body=b"") sends a raw HTTP request to the mock and returns a Response(status, headers, body), for example to fetch a presigned URL.

S3 works with virtual-hosted (<bucket>.wasmo.local, the default) and path-style addressing, GetObject returns a botocore StreamingBody, and boto3.s3.transfer multipart uploads and ranged downloads work as against AWS. Clients created with an https:// endpoint send aws-chunked bodies with trailing checksums, which wasmo decodes.

A Mock is safe to use from several threads; calls into one instance are serialized.

Lambda functions created with create_function run handlers registered by name, on every invocation path (Invoke, SNS, EventBridge, S3 notifications, event source mappings, async destinations). A handler takes the decoded event and a wasmo.FunctionContext (function_name, aws_request_id, environment, log(), ...), returns a JSON-serializable value, and may call the same mock; an exception becomes a function error.

def resize(event, context):
    context.log(f"request {context.aws_request_id}")
    return {"ok": True}


aws.register_function("resize", resize)

Metadata

Release files for wasmo 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wasmo 0.1.1
File Size Uploaded Provenance Actions
wasmo-0.1.1.tar.gz 1.7 MB With provenance Details for wasmo-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wasmo 0.1.1
File Interpreter ABI Platform Actions
wasmo-0.1.1-py3-none-any.whl Python 3 none any Details for wasmo-0.1.1-py3-none-any.whl

Total release size: 3.3 MB

Release files / wasmo-0.1.1.tar.gz

Download URL wasmo-0.1.1.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
d1aba34edb78bbd49a62a3a51cb8032cc750c2d8b67125b405a3a571361210e1
BLAKE2b-256 checksum
How to use checksums
2c533f4c3c2ac4aef9a139f924806303f3ee30c548bfa9c559315d9c27b5b91f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / wasmo-0.1.1-py3-none-any.whl

Download URL wasmo-0.1.1-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c8466fdcc8ddc8002fce20549b01ddc57f766b8ead7605cf579600951c47f317
BLAKE2b-256 checksum
How to use checksums
79ade5374becbc4fb7adcfe74b8d65c22aead51777411d5cc12d207362461829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for wasmo 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wasmo-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page