1{
2 lib,
3 antlr4-python3-runtime,
4 aws-xray-sdk,
5 boto3,
6 botocore,
7 buildPythonPackage,
8 cfn-lint,
9 crc32c,
10 cryptography,
11 docker,
12 fetchPypi,
13 flask-cors,
14 flask,
15 freezegun,
16 graphql-core,
17 jinja2,
18 joserfc,
19 jsondiff,
20 jsonpath-ng,
21 multipart,
22 openapi-spec-validator,
23 py-partiql-parser,
24 pyparsing,
25 pytest-order,
26 pytest-xdist,
27 pytestCheckHook,
28 python-dateutil,
29 pythonOlder,
30 pyyaml,
31 requests,
32 responses,
33 setuptools,
34 werkzeug,
35 xmltodict,
36}:
37
38buildPythonPackage rec {
39 pname = "moto";
40 version = "5.0.18";
41 pyproject = true;
42
43 disabled = pythonOlder "3.8";
44
45 src = fetchPypi {
46 inherit pname version;
47 hash = "sha256-inrS9ToubMnbL/ZcDg1LXX54vAC4Jcnh/2zDlDceduk=";
48 };
49
50 build-system = [ setuptools ];
51
52 dependencies = [
53 boto3
54 botocore
55 cryptography
56 requests
57 xmltodict
58 werkzeug
59 python-dateutil
60 responses
61 jinja2
62 ];
63
64 optional-dependencies = {
65 all = [
66 antlr4-python3-runtime
67 aws-xray-sdk
68 cfn-lint
69 docker
70 flask
71 flask-cors
72 graphql-core
73 joserfc
74 jsondiff
75 jsonpath-ng
76 multipart
77 openapi-spec-validator
78 py-partiql-parser
79 pyparsing
80 pyyaml
81 setuptools
82 ];
83 proxy = [
84 antlr4-python3-runtime
85 aws-xray-sdk
86 cfn-lint
87 docker
88 graphql-core
89 joserfc
90 jsondiff
91 jsonpath-ng
92 multipart
93 openapi-spec-validator
94 py-partiql-parser
95 pyparsing
96 pyyaml
97 setuptools
98 ];
99 server = [
100 antlr4-python3-runtime
101 aws-xray-sdk
102 cfn-lint
103 docker
104 flask
105 flask-cors
106 graphql-core
107 joserfc
108 jsondiff
109 jsonpath-ng
110 openapi-spec-validator
111 py-partiql-parser
112 pyparsing
113 pyyaml
114 setuptools
115 ];
116 cognitoidp = [ joserfc ];
117 apigateway = [
118 pyyaml
119 joserfc
120 openapi-spec-validator
121 ];
122 apigatewayv2 = [
123 pyyaml
124 openapi-spec-validator
125 ];
126 cloudformation = [
127 aws-xray-sdk
128 cfn-lint
129 docker
130 graphql-core
131 joserfc
132 jsondiff
133 openapi-spec-validator
134 py-partiql-parser
135 pyparsing
136 pyyaml
137 setuptools
138 ];
139 dynamodb = [
140 docker
141 py-partiql-parser
142 ];
143 dynamodbstreams = [
144 docker
145 py-partiql-parser
146 ];
147 events = [ jsonpath-ng ];
148 glue = [ pyparsing ];
149 iotdata = [ jsondiff ];
150 resourcegroupstaggingapi = [
151 cfn-lint
152 docker
153 graphql-core
154 joserfc
155 jsondiff
156 openapi-spec-validator
157 py-partiql-parser
158 pyparsing
159 pyyaml
160 ];
161 s3 = [
162 pyyaml
163 py-partiql-parser
164 ];
165 sns = [ ];
166 stepfunctions = [
167 antlr4-python3-runtime
168 jsonpath-ng
169 ];
170 s3crc32c = [
171 pyyaml
172 py-partiql-parser
173 crc32c
174 ];
175 };
176
177 __darwinAllowLocalNetworking = true;
178
179 nativeCheckInputs = [
180 freezegun
181 pytest-order
182 pytest-xdist
183 pytestCheckHook
184 ] ++ optional-dependencies.all;
185
186 # Some tests depend on AWS credentials environment variables to be set.
187 env.AWS_ACCESS_KEY_ID = "ak";
188 env.AWS_SECRET_ACCESS_KEY = "sk";
189
190 pytestFlagsArray = [
191 "-m"
192 "'not network and not requires_docker'"
193
194 # Matches upstream configuration, presumably due to expensive setup/teardown.
195 "--dist"
196 "loadscope"
197 ];
198
199 disabledTests = [
200 # Fails at local name resolution
201 "test_with_custom_request_header"
202 "test_s3_server_post_cors_multiple_origins"
203 "test_create_multipart"
204 "test_aws_and_http_requests"
205 "test_http_requests"
206
207 # Fails at resolving google.com
208 "test_put_record_http_destination"
209 "test_put_record_batch_http_destination"
210
211 # Fails at resolving s3.amazonaws.com
212 "test_passthrough_calls_for_wildcard_urls"
213 "test_passthrough_calls_for_specific_url"
214 "test_passthrough_calls_for_entire_service"
215
216 # Download recordings returns faulty JSON
217 "test_ec2_instance_creation_recording_on"
218 "test_ec2_instance_creation__recording_off"
219
220 # Connection Reset by Peer, when connecting to localhost:5678
221 "test_replay"
222
223 # Flaky under parallel execution
224 "test_cloudformation_server_get"
225 "test_should_find_bucket"
226
227 # AssertionError: assert ResourceWarning not in [<class 'ResourceWarning'>, <class 'ResourceWarning'>]
228 "test_delete_object_with_version"
229
230 # KeyError beucase of ap-southeast-5-apse5-az
231 "test_zoneId_in_availability_zones"
232
233 # Parameter validation fails
234 "test_conditional_write"
235 ];
236
237 disabledTestPaths = [
238 # Flaky under parallel execution, Connection Reset errors to localhost.
239 "tests/test_moto_api/recorder/test_recorder.py"
240
241 # Flaky under parallel execution
242 "tests/test_resourcegroupstaggingapi/*.py"
243
244 # Tries to access the network
245 "tests/test_batch/test_batch_jobs.py"
246
247 # Threading tests regularly blocks test execution
248 "tests/test_utilities/test_threaded_server.py"
249 "tests/test_s3/test_s3_bucket_policy.py"
250
251 # https://github.com/getmoto/moto/issues/7786
252 "tests/test_dynamodb/test_dynamodb_import_table.py"
253
254 # Infinite recursion with pycognito
255 "tests/test_cognitoidp/test_cognitoidp.py"
256 ];
257
258 meta = {
259 description = "Allows your tests to easily mock out AWS Services";
260 homepage = "https://github.com/getmoto/moto";
261 changelog = "https://github.com/getmoto/moto/blob/${version}/CHANGELOG.md";
262 license = lib.licenses.asl20;
263 maintainers = with lib.maintainers; [ onny ];
264 };
265}