[arch-commits] Commit in python-moto/trunk (PKGBUILD)

Chih-Hsuan Yen yan12125 at gemini.archlinux.org
Fri Dec 17 08:06:38 UTC 2021


    Date: Friday, December 17, 2021 @ 08:06:38
  Author: yan12125
Revision: 1075902

upgpkg: python-moto 2.2.19-1; give up tests that require podman/docker

Modified:
  python-moto/trunk/PKGBUILD

----------+
 PKGBUILD |   43 ++++++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 25 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-12-17 07:59:57 UTC (rev 1075901)
+++ PKGBUILD	2021-12-17 08:06:38 UTC (rev 1075902)
@@ -4,7 +4,7 @@
 pkgname=python-moto
 _pkgname=moto
 # https://github.com/spulec/moto/blob/master/CHANGELOG.md
-pkgver=2.2.17
+pkgver=2.2.19
 pkgrel=1
 pkgdesc='Moto is a library to mock out the boto library.'
 arch=(any)
@@ -21,7 +21,7 @@
 # See reqquirements-test.txt, excluding pytest-cov
 checkdepends=(python-pytest python-sure python-freezegun
               # boto is vendored (#3503), but still imported in tests
-              python-boto podman)
+              python-boto)
 # Below are optional dependencies. The order matches _dep_* items in upstream `setup.py`.
 # Note that _dep_python_jose_ecdsa_pin and _dep_idna are excluded as they are pins and
 # not used by moto.
@@ -41,17 +41,26 @@
 checkdepends+=(python-yaml python-jose python-docker python-jsondiff python-aws-xray-sdk
                python-cfn-lint python-sshpubkeys python-flask python-flask-cors)
 source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz"
-        sdist-no-pyc.diff
-        "$pkgname-fix-sqs-tests.patch"::"https://github.com/spulec/moto/commit/cbfe962b707ae039579247d23e6d20efa259eaaf.patch")
-sha256sums=('221ebd16b41b3ae157554ca5e540a8c1b4b1c93443cbf854c1f04751194c51b6'
-            '4193bd88380f6ab8dac49be37d940993dee4e31351ffd60c8167b7c8e5ec3208'
-            'e10558c48beac34846c5fb556c23c80d2e249d89746b9972484ee9db820c2123')
+        sdist-no-pyc.diff)
+sha256sums=('c07dba1bf56c7f0b67899936f8c2bfcbd0b77cbaba97056c2871de806a06fe8f'
+            '4193bd88380f6ab8dac49be37d940993dee4e31351ffd60c8167b7c8e5ec3208')
 
 prepare() {
   cd $_pkgname-$pkgver
 
+  # 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\1 at pytest.mark.needs_docker/" \
+      -e "s/^(\s*)(@mock_lambda)$/\1\2\n\1 at pytest.mark.needs_docker/"
+    grep __future__ "%" || sed -i "1i import pytest" "%"
+  '
+
   patch -Np1 -i ../sdist-no-pyc.diff
-  patch -Np1 -i ../$pkgname-fix-sqs-tests.patch
 
   # Remove upper bounds of dependencies
   sed --in-place=.orig -r 's#,?<[0-9.]+,?##;s#==([0-9.]+)#>=\1#' setup.py
@@ -67,23 +76,7 @@
 check() {
   cd $_pkgname-$pkgver
 
-  # XXX: there are too many tests that depend on docker/podman, and there is no simple way
-  # other than listing one-by-one for exclusion. To make things worse, running docker/podman
-  # in systemd-nspawn containers appears impossible without special configurations. I gave
-  # it up and running podman _outside_ the container for testing.
-  # $ systemctl --user start podman.socket
-  # $ extra-x86_64-build -- -d "$XDG_RUNTIME_DIR/podman:/tmp/podman"
-  PODMAN_SOCK=/tmp/podman/podman.sock
-  if [ -S $PODMAN_SOCK ]; then
-    # XXX: a workaround to make tests work with podman
-    # Images are not pulled before usage since version 2.2.1 [1][2], and
-    # that is needed for podman [3]
-    # [1] https://github.com/spulec/moto/commit/338420c3b979b85501193d948ab442c1ebd0ae4a
-    # [2] https://github.com/spulec/moto/pull/4082
-    # [3] https://github.com/spulec/moto/pull/3702
-    podman-remote --url "unix:$PODMAN_SOCK" pull docker.io/library/busybox:latest
-    DOCKER_HOST="unix://$PODMAN_SOCK" TZ=UTC pytest tests
-  fi
+  TZ=UTC pytest tests -m 'not needs_docker'
 }
 
 package() {



More information about the arch-commits mailing list