Date: Saturday, May 6, 2023 @ 09:22:06
Author: yan12125
Revision: 1458958
archrelease: copy trunk to community-any
Added:
python-moto/repos/community-any/PKGBUILD
(from rev 1458957, python-moto/trunk/PKGBUILD)
python-moto/repos/community-any/fix-tests.diff
(from rev 1458957, python-moto/trunk/fix-tests.diff)
python-moto/repos/community-any/werkzeug-2.3.diff
(from rev 1458957, python-moto/trunk/werkzeug-2.3.diff)
Deleted:
python-moto/repos/community-any/PKGBUILD
-------------------+
PKGBUILD | 168 ++++++++++++++++++++++++----------------------------
fix-tests.diff | 11 +++
werkzeug-2.3.diff | 41 ++++++++++++
3 files changed, 132 insertions(+), 88 deletions(-)
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2023-05-06 09:21:16 UTC (rev 1458957)
+++ PKGBUILD 2023-05-06 09:22:06 UTC (rev 1458958)
@@ -1,88 +0,0 @@
-# Maintainer: Chih-Hsuan Yen <[email protected]>
-# Contributor: Guillaume Horel <[email protected]>
-
-pkgname=python-moto
-_pkgname=moto
-# https://github.com/spulec/moto/blob/master/CHANGELOG.md
-pkgver=4.1.4
-pkgrel=3
-pkgdesc='Moto is a library to mock out the boto library.'
-arch=(any)
-url='https://github.com/spulec/moto'
-license=(Apache)
-# NOTE: Keep the order of dependencies matching setup.cfg
-# setup.cfg includes setuptools, which is a work around for missing
dependencies in aws-xray-sdk [1].
-# I use the correct dependency in python-aws-xray-sdk, so python-setuptools is
not needed here.
-# [1] https://github.com/spulec/moto/pull/4142
-depends=(python python-boto3 python-botocore python-cryptography
python-requests python-xmltodict
- python-werkzeug python-dateutil python-responses
- python-jinja
- # urllib3 is used by cfnresponse.py, not directly by moto - just to
make namcap happy
- python-urllib3)
-makedepends=(python-build python-installer python-setuptools python-wheel)
-# See reqquirements-test.txt, excluding pytest-cov
-checkdepends=(python-pytest python-sure python-freezegun)
-# Below are optional dependencies. The order matches _dep_* items in upstream
`setup.cfg`.
-# Note that _dep_python_jose_ecdsa_pin and _dep_idna are excluded as they are
pins and
-# not used by moto.
-optdepends=(
- 'python-yaml: for apigatewayv2, cloudformation, s3 and ssm'
- 'python-jose: for apigateway, cloudformation and cognitoidp'
- 'python-openapi-spec-validator: for apigateway and cloudformation'
- # SNS and SQS still uses docker indirectly, while upstream explicitly
removes them
- # https://github.com/spulec/moto/pull/4094
- 'python-docker: for awslambda, batch, cloudformation, dynamodb2 and
dynamodbstreams'
- 'python-graphql-core: For appsync and cloudformation'
- 'python-jsondiff: for iotdata and cloudformation'
- 'python-aws-xray-sdk: for xray and cloudformation'
- 'python-cfn-lint: for cloudformation'
- 'python-sshpubkeys: for ec2, ebs, efs, directoryservice and cloudformation'
- 'python-pyparsing: for glue and cloudformation'
- 'python-flask: for moto_server'
- 'python-flask-cors: for moto_server'
-)
-checkdepends+=(python-yaml python-jose python-openapi-spec-validator
python-docker
- python-graphql-core python-jsondiff python-aws-xray-sdk
- python-cfn-lint python-sshpubkeys python-pyparsing python-flask
python-flask-cors)
-source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz")
-sha256sums=('304cb19eee0019cd13f7d87ca590a4694677469c383ab8f8439fcb6717c47037')
-
-prepare() {
- cd $_pkgname-$pkgver
-
- cp setup.cfg{,.orig}
-
- # AWS Lambda and Batch tests require docker/podman, while running
docker/podman
- # in systemd-nspawn containers appears impossible without special
configurations -
- # disable them altogether
- sed -i '/markers\s*=/a \ \ \ \ needs_docker: marks test which require
docker' setup.cfg
- find tests \( -name '*.py' -a ! -name __init__.py \) -print0 | xargs -I % -0
bash -c '
- sed -i -E "%" \
- -e "/__future__/a import pytest" \
- -e "s/^(\s*)(@mock_batch)$/\1\2\n\[email protected]_docker/" \
- -e "s/^(\s*)(@mock_lambda)$/\1\2\n\[email protected]_docker/"
- grep __future__ "%" || sed -i "1i import pytest" "%"
- '
-
- # Remove upper bounds of dependencies
- sed -i -r 's#,?<[0-9.]+,?##;s#==([0-9.]+)#>=\1#' setup.cfg
- diff -u setup.cfg{.orig,} || true
-}
-
-build() {
- cd $_pkgname-$pkgver
-
- python -m build --wheel --no-isolation
-}
-
-check() {
- cd $_pkgname-$pkgver
-
- PYTHONDONTWRITEBYTECODE=1 TZ=UTC pytest tests -m 'not needs_docker'
-}
-
-package() {
- cd $_pkgname-$pkgver
-
- python -m installer --destdir="$pkgdir" dist/*.whl
-}
Copied: python-moto/repos/community-any/PKGBUILD (from rev 1458957,
python-moto/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2023-05-06 09:22:06 UTC (rev 1458958)
@@ -0,0 +1,80 @@
+# Maintainer: Chih-Hsuan Yen <[email protected]>
+# Contributor: Guillaume Horel <[email protected]>
+
+pkgname=python-moto
+_pkgname=moto
+# https://github.com/spulec/moto/blob/master/CHANGELOG.md
+pkgver=4.1.8
+pkgrel=1
+pkgdesc='Moto is a library to mock out the boto library.'
+arch=(any)
+url='https://github.com/spulec/moto'
+license=(Apache)
+# NOTE: Keep the order of dependencies matching setup.cfg
+# setup.cfg includes setuptools, which is a work around for missing
dependencies in aws-xray-sdk [1].
+# I use the correct dependency in python-aws-xray-sdk, so python-setuptools is
not needed here.
+# [1] https://github.com/spulec/moto/pull/4142
+depends=(python python-boto3 python-botocore python-cryptography
python-requests python-xmltodict
+ python-werkzeug python-dateutil python-responses
+ python-jinja
+ # urllib3 is used by cfnresponse.py, not directly by moto - just to
make namcap happy
+ python-urllib3)
+makedepends=(python-build python-installer python-setuptools python-wheel)
+# See reqquirements-test.txt, excluding pytest-cov
+checkdepends=(python-pytest python-pytest-ordering python-sure
python-freezegun)
+# Check extras_require in upstream `setup.cfg` for optional dependencies.
+# Note that ecdsa is excluded as it is pinned for jose and not used by moto.
+optdepends=(
+ 'python-yaml: for apigatewayv2, cloudformation, s3 and ssm'
+ 'python-jose: for apigateway, cloudformation and cognitoidp'
+ 'python-openapi-spec-validator: for apigateway and cloudformation'
+ # SNS and SQS still uses docker indirectly, while upstream explicitly
removes them
+ # https://github.com/spulec/moto/pull/4094
+ 'python-docker: for awslambda, batch, cloudformation, dynamodb and
dynamodbstreams'
+ 'python-graphql-core: For appsync and cloudformation'
+ 'python-jsondiff: for iotdata and cloudformation'
+ 'python-aws-xray-sdk: for xray and cloudformation'
+ 'python-cfn-lint: for cloudformation'
+ 'python-sshpubkeys: for cloudformation, directoryservice, ebs, ec2, efs, eks
and route53resolver'
+ 'python-pyparsing: for glue and cloudformation'
+ 'python-py-partiql-parser: for cloudformation and s3'
+ 'python-flask: for moto_server'
+ 'python-flask-cors: for moto_server'
+)
+checkdepends+=(python-yaml python-jose python-openapi-spec-validator
python-docker
+ python-graphql-core python-jsondiff python-aws-xray-sdk
+ python-cfn-lint python-sshpubkeys python-pyparsing
python-py-partiql-parser
+ python-flask python-flask-cors)
+source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz"
+ "fix-tests.diff"
+ "werkzeug-2.3.diff")
+sha256sums=('c3ecc2dda1a7b3a3c46655490bc6a4660b7bb47e31eaed7bbd54adeb01f8471f'
+ '21305cdf3d650ced1acb1d0f7dde8760b26e32a94c56a5571e798d6b6976cf5a'
+ '34bb8c75e67799c1c09c4996ef89476e6b93ad8b79f4fd294019c12249b02357')
+
+prepare() {
+ cd $_pkgname-$pkgver
+
+ patch -Np1 -i ../fix-tests.diff
+ # A combined patch from https://github.com/getmoto/moto/pull/6266 and
https://github.com/getmoto/moto/pull/6257
+ # Both are merged to git-master
+ patch -Np1 -i ../werkzeug-2.3.diff
+}
+
+build() {
+ cd $_pkgname-$pkgver
+
+ python -m build --wheel --no-isolation
+}
+
+check() {
+ cd $_pkgname-$pkgver
+
+ TZ=UTC pytest tests -m 'not requires_docker'
+}
+
+package() {
+ cd $_pkgname-$pkgver
+
+ python -m installer --destdir="$pkgdir" dist/*.whl
+}
Copied: python-moto/repos/community-any/fix-tests.diff (from rev 1458957,
python-moto/trunk/fix-tests.diff)
===================================================================
--- fix-tests.diff (rev 0)
+++ fix-tests.diff 2023-05-06 09:22:06 UTC (rev 1458958)
@@ -0,0 +1,11 @@
+--- a/tests/test_core/test_request_mocking.py 2023-04-25 01:11:07.284562629
+0800
++++ b/tests/test_core/test_request_mocking.py 2023-04-25 01:10:53.118267009
+0800
+@@ -13,7 +13,7 @@
+ conn.create_queue(QueueName="queue1")
+
+ res = requests.get("https://google.com/")
+- assert res.status_code < 400
++ assert res.status_code < 400 or res.status_code == 429
+
+
+ if not settings.TEST_SERVER_MODE:
Copied: python-moto/repos/community-any/werkzeug-2.3.diff (from rev 1458957,
python-moto/trunk/werkzeug-2.3.diff)
===================================================================
--- werkzeug-2.3.diff (rev 0)
+++ werkzeug-2.3.diff 2023-05-06 09:22:06 UTC (rev 1458958)
@@ -0,0 +1,41 @@
+diff --git a/moto/moto_server/werkzeug_app.py
b/moto/moto_server/werkzeug_app.py
+index 14f85517..234a74d4 100644
+--- a/moto/moto_server/werkzeug_app.py
++++ b/moto/moto_server/werkzeug_app.py
+@@ -201,7 +201,7 @@ class DomainDispatcherApplication:
+ finally:
+ if body:
+ # We've consumed the body = need to reset it
+- environ["wsgi.input"] = io.StringIO(body)
++ environ["wsgi.input"] = io.BytesIO(body.encode("utf-8"))
+ return body
+
+ def get_service_from_body(
+diff --git a/tests/test_moto_api/recorder/__init__.py
b/tests/test_moto_api/recorder/__init__.py
+new file mode 100644
+index 00000000..e69de29b
+diff --git a/tests/test_moto_api/recorder/test_recorder.py
b/tests/test_moto_api/recorder/test_recorder.py
+index f716b3d6..5eef5919 100644
+--- a/tests/test_moto_api/recorder/test_recorder.py
++++ b/tests/test_moto_api/recorder/test_recorder.py
+@@ -1,3 +1,4 @@
++import base64
+ import boto3
+ import json
+ import requests
+@@ -81,8 +82,13 @@ class TestRecorder(TestCase):
+
+ content = json.loads(self._download_recording())
+
+- content.should.have.key("body").should.contain("Action=RunInstances")
+-
content.should.have.key("body").should.contain(f"ImageId={EXAMPLE_AMI_ID}")
++ if content.get("body_encoded"):
++ body = base64.b64decode(content.get("body")).decode("ascii")
++ else:
++ body = content["body"]
++
++ body.should.contain("Action=RunInstances")
++ body.should.contain(f"ImageId={EXAMPLE_AMI_ID}")
+
+ def test_multiple_services(self):
+ self._start_recording()