1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 boto3,
12 botocore,
13 cryptography,
14 jinja2,
15 python-dateutil,
16 requests,
17 responses,
18 werkzeug,
19 xmltodict,
20
21 # optional-dependencies
22 antlr4-python3-runtime,
23 aws-xray-sdk,
24 cfn-lint,
25 flask,
26 flask-cors,
27 docker,
28 graphql-core,
29 joserfc,
30 jsonpath-ng,
31 jsondiff,
32 multipart,
33 openapi-spec-validator,
34 py-partiql-parser,
35 pyparsing,
36 pyyaml,
37
38 # tests
39 freezegun,
40 pytestCheckHook,
41 pytest-order,
42 pytest-xdist,
43}:
44
45buildPythonPackage rec {
46 pname = "moto";
47 version = "5.0.5";
48 pyproject = true;
49
50 disabled = pythonOlder "3.6";
51
52 src = fetchPypi {
53 inherit pname version;
54 hash = "sha256-Lqyi33dY9oaN9CC/ByXNC5PZhwlgbx+4sjQ7W9yCLZE=";
55 };
56
57 build-system = [ setuptools ];
58
59 propagatedBuildInputs = [
60 boto3
61 botocore
62 cryptography
63 requests
64 xmltodict
65 werkzeug
66 python-dateutil
67 responses
68 jinja2
69 ];
70
71 passthru.optional-dependencies = {
72 # non-exhaustive list of extras, that was cobbled together for testing
73 all = [
74 antlr4-python3-runtime
75 aws-xray-sdk
76 cfn-lint
77 docker
78 flask
79 flask-cors
80 graphql-core
81 joserfc
82 jsondiff
83 jsonpath-ng
84 multipart
85 openapi-spec-validator
86 pyparsing
87 py-partiql-parser
88 pyyaml
89 setuptools
90 ];
91 cognitoidp = [ joserfc ];
92 };
93
94 __darwinAllowLocalNetworking = true;
95
96 nativeCheckInputs = [
97 freezegun
98 pytestCheckHook
99 pytest-order
100 pytest-xdist
101 ] ++ passthru.optional-dependencies.all;
102
103 # Some tests depend on AWS credentials environment variables to be set.
104 env.AWS_ACCESS_KEY_ID = "ak";
105 env.AWS_SECRET_ACCESS_KEY = "sk";
106
107 pytestFlagsArray = [
108 "-m"
109 "'not network and not requires_docker'"
110
111 # Matches upstream configuration, presumably due to expensive setup/teardown.
112 "--dist"
113 "loadscope"
114
115 # Fails at local name resolution
116 "--deselect=tests/test_s3/test_multiple_accounts_server.py::TestAccountIdResolution::test_with_custom_request_header"
117 "--deselect=tests/test_s3/test_server.py::test_s3_server_post_cors_multiple_origins"
118 "--deselect=tests/test_s3/test_s3_file_handles.py::TestS3FileHandleClosuresUsingMocks::test_create_multipart"
119 "--deselect=tests/test_core/test_responses_module.py::TestResponsesMockWithPassThru::test_aws_and_http_requests"
120 "--deselect=tests/test_core/test_responses_module.py::TestResponsesMockWithPassThru::test_http_requests"
121
122 # Fails at resolving google.com
123 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_http_destination"
124 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_batch_http_destination"
125
126 # Fails at resolving s3.amazonaws.com
127 "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_wildcard_urls"
128 "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_specific_url"
129 "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_entire_service"
130
131 # Download recordings returns faulty JSON
132 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation_recording_on"
133 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation__recording_off"
134
135 # Connection Reset by Peer, when connecting to localhost:5678
136 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_replay"
137
138 # Flaky under parallel execution
139 "--deselect=tests/test_cloudformation/test_server.py::test_cloudformation_server_get"
140 "--deselect=tests/test_core/test_moto_api.py::TestModelDataResetForClassDecorator::test_should_find_bucket"
141
142 # AssertionError: assert ResourceWarning not in [<class 'ResourceWarning'>, <class 'ResourceWarning'>]
143 "--deselect=ests/test_s3/test_s3_file_handles.py::TestS3FileHandleClosuresUsingMocks::test_delete_object_with_version"
144 ];
145
146 disabledTestPaths = [
147 # Flaky under parallel execution, Connection Reset errors to localhost.
148 "tests/test_moto_api/recorder/test_recorder.py"
149
150 # Flaky under parallel execution
151 "tests/test_resourcegroupstaggingapi/*.py"
152
153 # Tries to access the network
154 "tests/test_batch/test_batch_jobs.py"
155
156 # Threading tests regularly blocks test execution
157 "tests/test_utilities/test_threaded_server.py"
158 "tests/test_s3/test_s3_bucket_policy.py"
159 ];
160
161 meta = with lib; {
162 description = "Allows your tests to easily mock out AWS Services";
163 homepage = "https://github.com/getmoto/moto";
164 changelog = "https://github.com/getmoto/moto/blob/${version}/CHANGELOG.md";
165 license = licenses.asl20;
166 maintainers = [ ];
167 };
168}