Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/moto/files/, dev-python/moto/
Date: Wed, 29 Apr 2020 23:11:11
Message-Id: 1588201859.cefee5c029474bc6ab3161b10992c8821a8d4d8c.chutzpah@gentoo
1 commit: cefee5c029474bc6ab3161b10992c8821a8d4d8c
2 Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
3 AuthorDate: Wed Apr 29 23:10:40 2020 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 29 23:10:59 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cefee5c0
7
8 dev-python/moto-1.3.14: Version bump, add py38
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.99, Repoman-2.3.22
12 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
13
14 dev-python/moto/Manifest | 1 +
15 .../moto/files/moto-1.3.14-newer-botocore.patch | 53 ++++++++++++++
16 dev-python/moto/files/moto-1.3.14-tests.patch | 82 +++++++++++++++++++++
17 dev-python/moto/moto-1.3.14.ebuild | 83 ++++++++++++++++++++++
18 4 files changed, 219 insertions(+)
19
20 diff --git a/dev-python/moto/Manifest b/dev-python/moto/Manifest
21 index f637ff3b189..f4626934981 100644
22 --- a/dev-python/moto/Manifest
23 +++ b/dev-python/moto/Manifest
24 @@ -1 +1,2 @@
25 +DIST moto-1.3.14.tar.gz 1829165 BLAKE2B 2ec30c4cc571492a9d2c08f66a39ad04cfc0baa7864db8a5be4ea9af24ecb59bad3e85c44fa8a7babc16bf66188cb6bef89484f1f302a11e6eec1f8dbf516492 SHA512 1fe7e9d49dadada82f24d6bef1c21419c414e027c21ed1099bd1eab7c269ac5638ed44a29d1557b37562a44b22a7c7251fc1ca8ba88cde6b82d39dbc620aa6a6
26 DIST moto-1.3.8.tar.gz 1571716 BLAKE2B 8e79808d8488bcf8c15e8b5a55e93392ceb5f642f1f52c0af441cecb7adfe23a718f6d283e473e5dab82ddd21bcbed36ecb52b444cbd933405d13c8818e4f74d SHA512 901556249a2a28885b7f77e9f2c209b06391efcea66b78ce3c16edec14bcd03b251c37ef5d800d8f7a35180d59ce7568a68bcebf18e25b092eb5de801db6c587
27
28 diff --git a/dev-python/moto/files/moto-1.3.14-newer-botocore.patch b/dev-python/moto/files/moto-1.3.14-newer-botocore.patch
29 new file mode 100644
30 index 00000000000..a12e3848336
31 --- /dev/null
32 +++ b/dev-python/moto/files/moto-1.3.14-newer-botocore.patch
33 @@ -0,0 +1,53 @@
34 +commit ef7fce5a4fcd951a6c2bd1b9c6d21e6cf6a711e2
35 +Author: gruebel <anton.gruebel@×××××.com>
36 +Date: Thu Nov 21 22:35:20 2019 +0100
37 +
38 + Fixed failing tests, due to a new required parameter StreamEnabled
39 +
40 +diff --git a/tests/test_dynamodbstreams/test_dynamodbstreams.py b/tests/test_dynamodbstreams/test_dynamodbstreams.py
41 +index 01cf915a..a98f97bf 100644
42 +--- a/tests/test_dynamodbstreams/test_dynamodbstreams.py
43 ++++ b/tests/test_dynamodbstreams/test_dynamodbstreams.py
44 +@@ -213,7 +213,7 @@ class TestEdges:
45 +
46 + resp = conn.update_table(
47 + TableName="test-streams",
48 +- StreamSpecification={"StreamViewType": "KEYS_ONLY"},
49 ++ StreamSpecification={"StreamEnabled": True, "StreamViewType": "KEYS_ONLY"},
50 + )
51 + assert "StreamSpecification" in resp["TableDescription"]
52 + assert resp["TableDescription"]["StreamSpecification"] == {
53 +@@ -226,7 +226,10 @@ class TestEdges:
54 + with assert_raises(conn.exceptions.ResourceInUseException):
55 + resp = conn.update_table(
56 + TableName="test-streams",
57 +- StreamSpecification={"StreamViewType": "OLD_IMAGES"},
58 ++ StreamSpecification={
59 ++ "StreamEnabled": True,
60 ++ "StreamViewType": "OLD_IMAGES",
61 ++ },
62 + )
63 +
64 + def test_stream_with_range_key(self):
65 +@@ -243,7 +246,7 @@ class TestEdges:
66 + {"AttributeName": "color", "AttributeType": "S"},
67 + ],
68 + ProvisionedThroughput={"ReadCapacityUnits": 1, "WriteCapacityUnits": 1},
69 +- StreamSpecification={"StreamViewType": "NEW_IMAGES"},
70 ++ StreamSpecification={"StreamEnabled": True, "StreamViewType": "NEW_IMAGES"},
71 + )
72 + stream_arn = resp["TableDescription"]["LatestStreamArn"]
73 +
74 +diff --git a/moto/core/responses.py b/moto/core/responses.py
75 +index bf4af902..c708edb8 100644
76 +--- a/moto/core/responses.py
77 ++++ b/moto/core/responses.py
78 +@@ -307,7 +307,7 @@ class BaseResponse(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
79 + def _convert(elem, is_last):
80 + if not re.match("^{.*}$", elem):
81 + return elem
82 +- name = elem.replace("{", "").replace("}", "")
83 ++ name = elem.replace("{", "").replace("}", "").replace("+", "")
84 + if is_last:
85 + return "(?P<%s>[^/]*)" % name
86 + return "(?P<%s>.*)" % name
87
88 diff --git a/dev-python/moto/files/moto-1.3.14-tests.patch b/dev-python/moto/files/moto-1.3.14-tests.patch
89 new file mode 100644
90 index 00000000000..4fdbf801eec
91 --- /dev/null
92 +++ b/dev-python/moto/files/moto-1.3.14-tests.patch
93 @@ -0,0 +1,82 @@
94 +diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py
95 +index 306deeea..7b8937ab 100644
96 +--- a/tests/test_awslambda/test_lambda.py
97 ++++ b/tests/test_awslambda/test_lambda.py
98 +@@ -22,6 +22,7 @@ from moto import (
99 + settings,
100 + mock_sqs,
101 + )
102 ++from unittest import skip
103 + from nose.tools import assert_raises
104 + from botocore.exceptions import ClientError
105 +
106 +@@ -1024,6 +1025,7 @@ def test_create_event_source_mapping():
107 + assert response["State"] == "Enabled"
108 +
109 +
110 ++@skip("fails in sandbox")
111 + @mock_logs
112 + @mock_lambda
113 + @mock_sqs
114 +@@ -1075,6 +1077,7 @@ def test_invoke_function_from_sqs():
115 + assert False, "Test Failed"
116 +
117 +
118 ++@skip("fails in sandbox")
119 + @mock_logs
120 + @mock_lambda
121 + @mock_dynamodb2
122 +@@ -1135,6 +1138,7 @@ def test_invoke_function_from_dynamodb():
123 + assert False, "Test Failed"
124 +
125 +
126 ++@skip("fails in sandbox")
127 + @mock_logs
128 + @mock_lambda
129 + @mock_sqs
130 +diff --git a/tests/test_cloudformation/test_validate.py b/tests/test_cloudformation/test_validate.py
131 +index 4dd4d7e0..3d1608e7 100644
132 +--- a/tests/test_cloudformation/test_validate.py
133 ++++ b/tests/test_cloudformation/test_validate.py
134 +@@ -2,6 +2,7 @@ from collections import OrderedDict
135 + import json
136 + import yaml
137 + import os
138 ++from unittest import skip
139 + import boto3
140 + from nose.tools import raises
141 + import botocore
142 +@@ -46,6 +47,7 @@ dummy_template_json = json.dumps(json_template)
143 + dummy_bad_template_json = json.dumps(json_bad_template)
144 +
145 +
146 ++@skip("needs network access")
147 + @mock_cloudformation
148 + def test_boto3_json_validate_successful():
149 + cf_conn = boto3.client("cloudformation", region_name="us-east-1")
150 +@@ -87,6 +89,7 @@ yaml_bad_template = """
151 + """
152 +
153 +
154 ++@skip("needs network access")
155 + @mock_cloudformation
156 + def test_boto3_yaml_validate_successful():
157 + cf_conn = boto3.client("cloudformation", region_name="us-east-1")
158 +diff --git a/tests/test_core/test_request_mocking.py b/tests/test_core/test_request_mocking.py
159 +index 2c44d52c..38c3a08d 100644
160 +--- a/tests/test_core/test_request_mocking.py
161 ++++ b/tests/test_core/test_request_mocking.py
162 +@@ -1,10 +1,13 @@
163 + import requests
164 + import sure # noqa
165 +
166 ++from unittest import skip
167 ++
168 + import boto3
169 + from moto import mock_sqs, settings
170 +
171 +
172 ++@skip("Needs network access")
173 + @mock_sqs
174 + def test_passthrough_requests():
175 + conn = boto3.client("sqs", region_name="us-west-1")
176
177 diff --git a/dev-python/moto/moto-1.3.14.ebuild b/dev-python/moto/moto-1.3.14.ebuild
178 new file mode 100644
179 index 00000000000..3e3d07f6fb8
180 --- /dev/null
181 +++ b/dev-python/moto/moto-1.3.14.ebuild
182 @@ -0,0 +1,83 @@
183 +# Copyright 1999-2020 Gentoo Authors
184 +# Distributed under the terms of the GNU General Public License v2
185 +
186 +EAPI=7
187 +PYTHON_COMPAT=( python3_{6,7,8} )
188 +DISTUTILS_USE_SETUPTOOLS=rdepend
189 +inherit distutils-r1
190 +
191 +DESCRIPTION="Mock library for boto"
192 +HOMEPAGE="https://github.com/spulec/moto"
193 +SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
194 +
195 +LICENSE="Apache-2.0"
196 +SLOT="0"
197 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
198 +
199 +IUSE="test"
200 +RESTRICT="!test? ( test )"
201 +
202 +RDEPEND="
203 + >=dev-python/aws-xray-sdk-python-0.93[${PYTHON_USEDEP}]
204 + $(python_gen_cond_dep 'dev-python/backports-tempfile[${PYTHON_USEDEP}]' python3_{6,7})
205 + dev-python/cfn-python-lint[${PYTHON_USEDEP}]
206 + >=dev-python/cryptography-2.3.0[${PYTHON_USEDEP}]
207 + dev-python/cookies[${PYTHON_USEDEP}]
208 + dev-python/dicttoxml[${PYTHON_USEDEP}]
209 + >=dev-python/docker-py-2.5.1[${PYTHON_USEDEP}]
210 + >=dev-python/idna-2.5[${PYTHON_USEDEP}]
211 + >=dev-python/jinja-2.10.1[${PYTHON_USEDEP}]
212 + >=dev-python/jsondiff-1.1.2[${PYTHON_USEDEP}]
213 + >=dev-python/boto-2.36.0[${PYTHON_USEDEP}]
214 + >=dev-python/boto3-1.9.201[${PYTHON_USEDEP}]
215 + >=dev-python/botocore-1.12.201[${PYTHON_USEDEP}]
216 + dev-python/flask[${PYTHON_USEDEP}]
217 + dev-python/pretty-yaml[${PYTHON_USEDEP}]
218 + >=dev-python/pyyaml-5.1[${PYTHON_USEDEP}]
219 + >=dev-python/python-dateutil-2.1[${PYTHON_USEDEP}]
220 + dev-python/pytz[${PYTHON_USEDEP}]
221 + dev-python/python-dateutil[${PYTHON_USEDEP}]
222 + dev-python/python-jose[${PYTHON_USEDEP}]
223 + >=dev-python/responses-0.9.0[${PYTHON_USEDEP}]
224 + >=dev-python/requests-2.5[${PYTHON_USEDEP}]
225 + dev-python/xmltodict[${PYTHON_USEDEP}]
226 + >=dev-python/six-1.9[${PYTHON_USEDEP}]
227 + dev-python/werkzeug[${PYTHON_USEDEP}]
228 +"
229 +BDEPEND="
230 + test? ( ${RDEPEND}
231 + dev-python/freezegun[${PYTHON_USEDEP}]
232 + dev-python/mock[${PYTHON_USEDEP}]
233 + dev-python/nose[${PYTHON_USEDEP}]
234 + dev-python/responses[${PYTHON_USEDEP}]
235 + >=dev-python/sure-1.4.11[${PYTHON_USEDEP}]
236 + )
237 +"
238 +
239 +PATCHES=(
240 + "${FILESDIR}/moto-1.3.14-newer-botocore.patch"
241 + "${FILESDIR}/moto-1.3.14-tests.patch"
242 +)
243 +
244 +distutils_enable_tests nose
245 +
246 +python_prepare_all() {
247 + sed -e 's|==|>=|' \
248 + -e '/cfn-lint/ d' \
249 + -i setup.py moto.egg-info/requires.txt || die
250 +
251 + # Disable tests that fail with network-sandbox.
252 + sed -e 's|^\(def \)\(test_context_manager()\)|\1_\2|' \
253 + -e 's|^\(def \)\(test_decorator_start_and_stop()\)|\1_\2|' \
254 + -i tests/test_core/test_decorator_calls.py || die
255 +
256 + # Disable tests that fail with userpriv.
257 + sed -e 's|^\(def \)\(test_invoke_function_from_sns()\)|\1_\2|' \
258 + -e 's|^\(def \)\(test_invoke_requestresponse_function()\)|\1_\2|' \
259 + -i tests/test_awslambda/test_lambda.py || die
260 +
261 + # these tests crash nose
262 + rm tests/test_xray/test_xray_client.py || die
263 +
264 + distutils-r1_python_prepare_all
265 +}