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 fetchFromGitHub,
13 fetchpatch,
14 flask-cors,
15 flask,
16 freezegun,
17 graphql-core,
18 jinja2,
19 joserfc,
20 jsonpath-ng,
21 jsonschema,
22 multipart,
23 openapi-spec-validator,
24 py-partiql-parser,
25 pyparsing,
26 pytest-order,
27 pytest-xdist,
28 pytestCheckHook,
29 python-dateutil,
30 pythonOlder,
31 pyyaml,
32 requests,
33 responses,
34 setuptools,
35 werkzeug,
36 xmltodict,
37}:
38
39buildPythonPackage rec {
40 pname = "moto";
41 version = "5.1.4";
42 pyproject = true;
43
44 disabled = pythonOlder "3.8";
45
46 src = fetchFromGitHub {
47 owner = "getmoto";
48 repo = "moto";
49 tag = version;
50 hash = "sha256-bDRd1FTBpv6t2j8cBzcYiK4B0F4sLcoW9K0Wnd0oo+4=";
51 };
52
53 # Fix tests with botocore 1.38.32
54 # FIXME: remove in next update
55 patches = [
56 (fetchpatch {
57 url = "https://github.com/getmoto/moto/commit/8dcaaca0eefdf9ac957650c1562317b6d07fadf9.diff";
58 hash = "sha256-5zaerJR1rsMZQLn8cXjS8RYiKlSQ6azp7dk7JzLp+7I=";
59 })
60 ];
61
62 build-system = [
63 setuptools
64 ];
65
66 dependencies = [
67 boto3
68 botocore
69 cryptography
70 requests
71 xmltodict
72 werkzeug
73 python-dateutil
74 responses
75 jinja2
76 ];
77
78 optional-dependencies = {
79 all = [
80 antlr4-python3-runtime
81 joserfc
82 jsonpath-ng
83 docker
84 graphql-core
85 pyyaml
86 cfn-lint
87 jsonschema
88 openapi-spec-validator
89 pyparsing
90 py-partiql-parser
91 aws-xray-sdk
92 setuptools
93 multipart
94 ];
95 proxy = [
96 antlr4-python3-runtime
97 joserfc
98 jsonpath-ng
99 docker
100 graphql-core
101 pyyaml
102 cfn-lint
103 openapi-spec-validator
104 pyparsing
105 py-partiql-parser
106 aws-xray-sdk
107 setuptools
108 multipart
109 ];
110 server = [
111 antlr4-python3-runtime
112 joserfc
113 jsonpath-ng
114 docker
115 graphql-core
116 pyyaml
117 cfn-lint
118 openapi-spec-validator
119 pyparsing
120 py-partiql-parser
121 aws-xray-sdk
122 setuptools
123 flask
124 flask-cors
125 ];
126 acm = [ ];
127 acmpca = [ ];
128 amp = [ ];
129 apigateway = [
130 pyyaml
131 joserfc
132 openapi-spec-validator
133 ];
134 apigatewayv2 = [
135 pyyaml
136 openapi-spec-validator
137 ];
138 applicationautoscaling = [ ];
139 appsync = [
140 graphql-core
141 ];
142 athena = [ ];
143 autoscaling = [ ];
144 awslambda = [
145 docker
146 ];
147 awslambda_simple = [ ];
148 backup = [ ];
149 batch = [
150 docker
151 ];
152 batch_simple = [ ];
153 budgets = [ ];
154 ce = [ ];
155 cloudformation = [
156 joserfc
157 docker
158 graphql-core
159 pyyaml
160 cfn-lint
161 openapi-spec-validator
162 pyparsing
163 py-partiql-parser
164 aws-xray-sdk
165 setuptools
166 ];
167 cloudfront = [ ];
168 cloudtrail = [ ];
169 cloudwatch = [ ];
170 codebuild = [ ];
171 codecommit = [ ];
172 codepipeline = [ ];
173 cognitoidentity = [ ];
174 cognitoidp = [
175 joserfc
176 ];
177 comprehend = [ ];
178 config = [ ];
179 databrew = [ ];
180 datapipeline = [ ];
181 datasync = [ ];
182 dax = [ ];
183 dms = [ ];
184 ds = [ ];
185 dynamodb = [
186 docker
187 py-partiql-parser
188 ];
189 dynamodbstreams = [
190 docker
191 py-partiql-parser
192 ];
193 ebs = [ ];
194 ec2 = [ ];
195 ec2instanceconnect = [ ];
196 ecr = [ ];
197 ecs = [ ];
198 efs = [ ];
199 eks = [ ];
200 elasticache = [ ];
201 elasticbeanstalk = [ ];
202 elastictranscoder = [ ];
203 elb = [ ];
204 elbv2 = [ ];
205 emr = [ ];
206 emrcontainers = [ ];
207 emrserverless = [ ];
208 es = [ ];
209 events = [
210 jsonpath-ng
211 ];
212 firehose = [ ];
213 forecast = [ ];
214 glacier = [ ];
215 glue = [
216 pyparsing
217 ];
218 greengrass = [ ];
219 guardduty = [ ];
220 iam = [ ];
221 inspector2 = [ ];
222 iot = [ ];
223 iotdata = [ ];
224 ivs = [ ];
225 kinesis = [ ];
226 kinesisvideo = [ ];
227 kinesisvideoarchivedmedia = [ ];
228 kms = [ ];
229 logs = [ ];
230 managedblockchain = [ ];
231 mediaconnect = [ ];
232 medialive = [ ];
233 mediapackage = [ ];
234 mediastore = [ ];
235 mediastoredata = [ ];
236 meteringmarketplace = [ ];
237 mq = [ ];
238 opsworks = [ ];
239 organizations = [ ];
240 panorama = [ ];
241 personalize = [ ];
242 pinpoint = [ ];
243 polly = [ ];
244 quicksight = [
245 jsonschema
246 ];
247 ram = [ ];
248 rds = [ ];
249 redshift = [ ];
250 redshiftdata = [ ];
251 rekognition = [ ];
252 resourcegroups = [ ];
253 resourcegroupstaggingapi = [
254 joserfc
255 docker
256 graphql-core
257 pyyaml
258 cfn-lint
259 openapi-spec-validator
260 pyparsing
261 py-partiql-parser
262 ];
263 route53 = [ ];
264 route53resolver = [ ];
265 s3 = [
266 pyyaml
267 py-partiql-parser
268 ];
269 s3crc32c = [
270 pyyaml
271 py-partiql-parser
272 crc32c
273 ];
274 s3control = [ ];
275 sagemaker = [ ];
276 sdb = [ ];
277 scheduler = [ ];
278 secretsmanager = [ ];
279 servicediscovery = [ ];
280 servicequotas = [ ];
281 ses = [ ];
282 signer = [ ];
283 sns = [ ];
284 sqs = [ ];
285 ssm = [
286 pyyaml
287 ];
288 ssoadmin = [ ];
289 stepfunctions = [
290 antlr4-python3-runtime
291 jsonpath-ng
292 ];
293 sts = [ ];
294 support = [ ];
295 swf = [ ];
296 textract = [ ];
297 timestreamwrite = [ ];
298 transcribe = [ ];
299 wafv2 = [ ];
300 xray = [
301 aws-xray-sdk
302 setuptools
303 ];
304 };
305
306 __darwinAllowLocalNetworking = true;
307
308 nativeCheckInputs = [
309 freezegun
310 pytest-order
311 pytest-xdist
312 pytestCheckHook
313 ]
314 ++ optional-dependencies.server;
315
316 # Some tests depend on AWS credentials environment variables to be set.
317 env.AWS_ACCESS_KEY_ID = "ak";
318 env.AWS_SECRET_ACCESS_KEY = "sk";
319
320 pytestFlags = [
321 # Matches upstream configuration, presumably due to expensive setup/teardown.
322 "--dist=loadscope"
323 ];
324
325 disabledTestMarks = [
326 "network"
327 "requires_docker"
328 ];
329
330 disabledTests = [
331 # Fails at local name resolution
332 "test_with_custom_request_header"
333 "test_s3_server_post_cors_multiple_origins"
334 "test_create_multipart"
335 "test_aws_and_http_requests"
336 "test_http_requests"
337
338 # Fails at resolving google.com
339 "test_put_record_http_destination"
340 "test_put_record_batch_http_destination"
341
342 # Fails at resolving s3.amazonaws.com
343 "test_passthrough_calls_for_wildcard_urls"
344 "test_passthrough_calls_for_specific_url"
345 "test_passthrough_calls_for_entire_service"
346
347 # Download recordings returns faulty JSON
348 "test_ec2_instance_creation_recording_on"
349 "test_ec2_instance_creation__recording_off"
350
351 # Connection Reset by Peer, when connecting to localhost:5678
352 "test_replay"
353
354 # Flaky under parallel execution
355 "test_cloudformation_server_get"
356 "test_should_find_bucket"
357
358 # AssertionError: assert ResourceWarning not in [<class 'ResourceWarning'>, <class 'ResourceWarning'>]
359 "test_delete_object_with_version"
360
361 # KeyError because of ap-southeast-5-apse5-az
362 "test_zoneId_in_availability_zones"
363
364 # Parameter validation fails
365 "test_conditional_write"
366
367 # Requires newer botocore version
368 "test_dynamodb_with_account_id_routing"
369
370 # Assumes too much about threading.Timer() behavior (that it honors the
371 # timeout precisely and that the thread handler will complete in just 0.1s
372 # from the requested timeout)
373 "test_start_and_fire_timer_decision"
374 ];
375
376 disabledTestPaths = [
377 # Flaky under parallel execution, Connection Reset errors to localhost.
378 "tests/test_moto_api/recorder/test_recorder.py"
379
380 # Flaky under parallel execution
381 "tests/test_resourcegroupstaggingapi/*.py"
382
383 # Tries to access the network
384 "tests/test_batch/test_batch_jobs.py"
385
386 # Threading tests regularly blocks test execution
387 "tests/test_utilities/test_threaded_server.py"
388 "tests/test_s3/test_s3_bucket_policy.py"
389
390 # https://github.com/getmoto/moto/issues/7786
391 "tests/test_dynamodb/test_dynamodb_import_table.py"
392
393 # Infinite recursion with pycognito
394 "tests/test_cognitoidp/test_cognitoidp.py"
395
396 # botocore.exceptions.ParamValidationError: Parameter validation failed: Unknown parameter in input: "EnableWorkDocs", must be one of: [...]
397 "tests/test_workspaces/test_workspaces.py"
398 ];
399
400 meta = {
401 description = "Allows your tests to easily mock out AWS Services";
402 homepage = "https://github.com/getmoto/moto";
403 changelog = "https://github.com/getmoto/moto/blob/${version}/CHANGELOG.md";
404 license = lib.licenses.asl20;
405 maintainers = with lib.maintainers; [ onny ];
406 };
407}