1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6
7# runtime
8, aws-xray-sdk
9, boto3
10, botocore
11, cfn-lint
12, cryptography
13, docker
14, flask
15, flask-cors
16, graphql-core
17, idna
18, jinja2
19, jsondiff
20, openapi-spec-validator
21, python-dateutil
22, python-jose
23, pytz
24, pyyaml
25, requests
26, responses
27, sshpubkeys
28, werkzeug
29, xmltodict
30
31# tests
32, freezegun
33, pytestCheckHook
34, pytest-xdist
35, sure
36}:
37
38buildPythonPackage rec {
39 pname = "moto";
40 version = "4.0.3";
41 format = "setuptools";
42
43 disabled = pythonOlder "3.6";
44
45 src = fetchPypi {
46 inherit pname version;
47 sha256 = "sha256-iutWdX5oavPkpj+Qr7yXPLIxrarYfFzonmiTbBCbC+k=";
48 };
49
50 postPatch = ''
51 substituteInPlace setup.py \
52 --replace "werkzeug>=0.5,<2.2.0" "werkzeug>=0.5"
53 '';
54
55 propagatedBuildInputs = [
56 aws-xray-sdk
57 boto3
58 botocore
59 cfn-lint
60 cryptography
61 docker
62 flask
63 flask-cors
64 graphql-core
65 idna
66 jinja2
67 jsondiff
68 openapi-spec-validator
69 python-dateutil
70 python-jose
71 pytz
72 pyyaml
73 requests
74 responses
75 sshpubkeys
76 werkzeug
77 xmltodict
78 ];
79
80 checkInputs = [
81 freezegun
82 pytestCheckHook
83 sure
84 ];
85
86 pytestFlagsArray = [
87 # Disable tests that try to access the network
88 "--deselect=tests/test_cloudformation/test_cloudformation_custom_resources.py::test_create_custom_lambda_resource__verify_cfnresponse_failed"
89 "--deselect=tests/test_cloudformation/test_server.py::test_cloudformation_server_get"
90 "--deselect=tests/test_core/test_decorator_calls.py::test_context_manager"
91 "--deselect=tests/test_core/test_decorator_calls.py::test_decorator_start_and_stop"
92 "--deselect=tests/test_core/test_request_mocking.py::test_passthrough_requests"
93 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_batch_http_destination"
94 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_http_destination"
95 "--deselect=tests/test_logs/test_integration.py::test_put_subscription_filter_with_lambda"
96 "--deselect=tests/test_sqs/test_integration.py::test_invoke_function_from_sqs_exception"
97 "--deselect=tests/test_sqs/test_sqs_integration.py::test_invoke_function_from_sqs_exception"
98 "--deselect=tests/test_stepfunctions/test_stepfunctions.py::test_state_machine_creation_fails_with_invalid_names"
99 "--deselect=tests/test_stepfunctions/test_stepfunctions.py::test_state_machine_list_executions_with_pagination"
100 "--deselect=tests/test_iotdata/test_iotdata.py::test_update"
101 "--deselect=tests/test_iotdata/test_iotdata.py::test_basic"
102 "--deselect=tests/test_iotdata/test_iotdata.py::test_delete_field_from_device_shadow"
103 "--deselect=tests/test_iotdata/test_iotdata.py::test_publish"
104 "--deselect=tests/test_s3/test_server.py::test_s3_server_bucket_versioning"
105 "--deselect=tests/test_s3/test_multiple_accounts_server.py::TestAccountIdResolution::test_with_custom_request_header"
106
107 # Disable tests that require docker daemon
108 "--deselect=tests/test_events/test_events_lambdatriggers_integration.py::test_creating_bucket__invokes_lambda"
109 "--deselect=tests/test_s3/test_s3_lambda_integration.py::test_objectcreated_put__invokes_lambda"
110
111 # json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
112 "--deselect=tests/test_cloudformation/test_cloudformation_stack_integration.py::test_lambda_function"
113
114 # AssertionError: CloudWatch log event was not found.
115 "--deselect=tests/test_logs/test_integration.py::test_subscription_filter_applies_to_new_streams"
116
117 # KeyError: 'global'
118 "--deselect=tests/test_iotdata/test_server.py::test_iotdata_list"
119 "--deselect=tests/test_iotdata/test_server.py::test_publish"
120
121 # Blocks test execution
122 "--deselect=tests/test_utilities/test_threaded_server.py::TestThreadedMotoServer::test_load_data_from_inmemory_client"
123 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
124 "--deselect=tests/test_utilities/test_threaded_server.py::test_threaded_moto_server__different_port"
125 "--deselect=tests/test_utilities/test_threaded_server.py::TestThreadedMotoServer::test_server_can_handle_multiple_services"
126 "--deselect=tests/test_utilities/test_threaded_server.py::TestThreadedMotoServer::test_server_is_reachable"
127
128 # AssertionError: expected `{0}` to be greater than `{1}`
129 "--deselect=tests/test_databrew/test_databrew_recipes.py::test_publish_recipe"
130 ];
131
132 disabledTestPaths = [
133 # xml.parsers.expat.ExpatError: out of memory: line 1, column 0
134 "tests/test_sts/test_sts.py"
135 # botocore.exceptions.NoCredentialsError: Unable to locate credentials
136 "tests/test_redshiftdata/test_redshiftdata.py"
137 # Tries to access the network
138 "tests/test_appsync/test_appsync_schema.py"
139 "tests/test_awslambda/test_lambda_eventsourcemapping.py"
140 "tests/test_awslambda/test_lambda_invoke.py"
141 "tests/test_batch/test_batch_jobs.py"
142 ];
143
144 disabledTests = [
145 # only appears in aarch64 currently, but best to be safe
146 "test_state_machine_list_executions_with_filter"
147 # tests fail with 404 after Werkzeug 2.2 upgrade, see https://github.com/spulec/moto/issues/5341#issuecomment-1206995825
148 "test_appsync_list_tags_for_resource"
149 "test_s3_server_post_to_bucket_redirect"
150 ];
151
152 meta = with lib; {
153 description = "Allows your tests to easily mock out AWS Services";
154 homepage = "https://github.com/spulec/moto";
155 license = licenses.asl20;
156 maintainers = [ ];
157 };
158}