{"id":27158,"library":"moto-ext","title":"moto-ext","description":"moto-ext is an extension of the moto library for mocking AWS services in tests. It provides additional AWS service mocks not included in the core moto package. Current version 5.1.33, requires Python >=3.9. Released as part of the moto ecosystem.","status":"active","version":"5.1.33","language":"python","source_language":"en","source_url":"https://github.com/localstack/moto","tags":["aws","mocking","testing","moto-ext","localstack"],"install":[{"cmd":"pip install moto-ext","lang":"bash","label":"Install moto-ext"}],"dependencies":[{"reason":"moto-ext depends on moto core for base mock infrastructure and service models.","package":"moto","optional":false},{"reason":"Required to interact with AWS services in tests.","package":"boto3","optional":false}],"imports":[{"note":"moto-ext is a separate package; importing from moto.extensions is incorrect.","wrong":"from moto import extensions","symbol":"moto_ext","correct":"import moto_ext"}],"quickstart":{"code":"import boto3\nfrom moto import mock_aws\nfrom moto_ext import some_mock  # replace with actual mock\n\n@mock_aws\ndef test_my_function():\n    client = boto3.client('sns', region_name='us-east-1')\n    response = client.create_topic(Name='test-topic')\n    assert 'TopicArn' in response\n","lang":"python","description":"Basic usage: use @mock_aws decorator from moto to mock all AWS services, including those provided by moto-ext."},"warnings":[{"fix":"Install 'moto-ext' via pip: pip install moto-ext.","message":"moto-ext is the successor to moto (the original package) for extended AWS mocks. The package name changed from 'moto' to 'moto-ext', but the import path remains 'moto'. Ensure you have installed 'moto-ext' and not just 'moto' to access additional mocks.","severity":"breaking","affected_versions":"<=5.1.33"},{"fix":"Use 'from moto import mock_aws' and all other imports from 'moto'.","message":"Do not import directly from 'moto_ext'. The correct import path is 'moto' (e.g., from moto import mock_aws). moto-ext adds extra mocks to the moto namespace.","severity":"gotcha","affected_versions":">=5.0"},{"fix":"Replace 'pip install moto' with 'pip install moto-ext'.","message":"The old package name 'moto' is deprecated. Starting from version 5.0, the package has been renamed to 'moto-ext'. Install 'moto-ext' to get updates.","severity":"deprecated","affected_versions":">=5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install moto-ext' to install the latest version.","cause":"moto-ext is not installed, or an older version of moto is installed.","error":"ImportError: cannot import name 'mock_aws' from 'moto'"},{"fix":"Use 'import moto' or 'from moto import mock_aws' instead.","cause":"Attempting to import from 'moto_ext' directly, but the import path is 'moto'.","error":"ModuleNotFoundError: No module named 'moto_ext'"},{"fix":"Access mocks directly via 'moto' (e.g., from moto import mock_sns).","cause":"Trying to import a submodule that does not exist; moto-ext mocks are fully integrated into the 'moto' namespace.","error":"AttributeError: module 'moto' has no attribute 'extensions'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}