1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5
6# build-system
7, setuptools
8
9# dependencies
10, boto3
11, botocore
12, cryptography
13, jinja2
14, python-dateutil
15, requests
16, responses
17, werkzeug
18, xmltodict
19
20# optional-dependencies
21, aws-xray-sdk
22, cfn-lint
23, docker
24, ecdsa
25, flask
26, flask-cors
27, graphql-core
28, jsondiff
29, multipart
30, openapi-spec-validator
31, py-partiql-parser
32, pyparsing
33, python-jose
34, pyyaml
35, sshpubkeys
36
37# tests
38, freezegun
39, pytestCheckHook
40, pytest-order
41, pytest-xdist
42}:
43
44buildPythonPackage rec {
45 pname = "moto";
46 version = "4.2.10";
47 pyproject = true;
48
49 disabled = pythonOlder "3.6";
50
51 src = fetchPypi {
52 inherit pname version;
53 hash = "sha256-kllf4odHSjGsPvhHlB67CX6P+ww9bBBuR89XPbBpM7I=";
54 };
55
56 nativeBuildInputs = [
57 setuptools
58 ];
59
60 propagatedBuildInputs = [
61 boto3
62 botocore
63 cryptography
64 requests
65 xmltodict
66 werkzeug
67 python-dateutil
68 responses
69 jinja2
70 ];
71
72 passthru.optional-dependencies = {
73 # non-exhaustive list of extras, that was cobbled together for testing
74 all = [
75 aws-xray-sdk
76 cfn-lint
77 docker
78 ecdsa
79 flask
80 flask-cors
81 graphql-core
82 jsondiff
83 multipart
84 openapi-spec-validator
85 py-partiql-parser
86 pyparsing
87 python-jose
88 pyyaml
89 setuptools
90 sshpubkeys
91 ] ++ python-jose.optional-dependencies.cryptography;
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" "'not network and not requires_docker'"
109
110 # Matches upstream configuration, presumably due to expensive setup/teardown.
111 "--dist" "loadscope"
112
113 # Fails at local name resolution
114 "--deselect=tests/test_s3/test_multiple_accounts_server.py::TestAccountIdResolution::test_with_custom_request_header"
115 "--deselect=tests/test_s3/test_server.py::test_s3_server_post_cors_multiple_origins"
116
117 # Fails at resolving google.com
118 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_http_destination"
119 "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_batch_http_destination"
120
121 # Download recordings returns faulty JSON
122 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation_recording_on"
123 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation__recording_off"
124
125 # Connection Reset by Peer, when connecting to localhost:5678
126 "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_replay"
127
128 # Requires docker, but isn't marked
129 # https://github.com/getmoto/moto/pull/6938
130 "--deselect=tests/test_awslambda/test_lambda_layers_invoked.py::test_invoke_local_lambda_layers"
131
132 # Flaky under parallel execution
133 "--deselect=tests/test_cloudformation/test_server.py::test_cloudformation_server_get"
134 "--deselect=tests/test_core/test_moto_api.py::TestModelDataResetForClassDecorator::test_should_find_bucket"
135 ];
136
137 disabledTestPaths = [
138 # Flaky under parallel execution, Connection Reset errors to localhost.
139 "tests/test_moto_api/recorder/test_recorder.py"
140
141 # Flaky under parallel execution
142 "tests/test_resourcegroupstaggingapi/*.py"
143
144 # Tries to access the network
145 "tests/test_batch/test_batch_jobs.py"
146
147 # Threading tests regularly blocks test execution
148 "tests/test_utilities/test_threaded_server.py"
149 "tests/test_s3/test_s3_bucket_policy.py"
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 changelog = "https://github.com/getmoto/moto/blob/${version}/CHANGELOG.md";
156 license = licenses.asl20;
157 maintainers = [ ];
158 };
159}