Chih-Hsuan Yen pushed to branch main at Arch Linux / Packaging / Packages / 
python-aiobotocore


Commits:
c540dac7 by Chih-Hsuan Yen at 2024-05-12T10:46:42+08:00
Add a work-around for moto 5.x

Preparing for 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-moto/-/issues/1

- - - - -


2 changed files:

- PKGBUILD
- + moto-5.x.diff


Changes:

=====================================
PKGBUILD
=====================================
@@ -17,8 +17,17 @@ makedepends=(python-build python-installer python-setuptools 
python-wheel)
 checkdepends=(python-moto python-pytest python-pytest-asyncio python-dill 
python-docutils python-pip
               # moto optdepends
               python-docker python-openapi-spec-validator python-yaml 
python-flask python-flask-cors)
-source=("https://github.com/aio-libs/aiobotocore/archive/$pkgver/$pkgname-$pkgver.tar.gz";)
-sha256sums=('fc714603137d8bac1458779523b87e7eddfde8b9effddd6f1dfaa2befe4fc471')
+source=("https://github.com/aio-libs/aiobotocore/archive/$pkgver/$pkgname-$pkgver.tar.gz";
+        "moto-5.x.diff")
+sha256sums=('fc714603137d8bac1458779523b87e7eddfde8b9effddd6f1dfaa2befe4fc471'
+            '2bfadc984a4ad3a6420b356d572c8085b82a46949fc0ecaea98ddce45980503b')
+
+prepare() {
+  cd $_pkgname-$pkgver
+  # Work-around test failures with moto 5.x
+  # See: https://github.com/aio-libs/aiobotocore/issues/1108
+  patch -Np1 -i ../moto-5.x.diff
+}
 
 build() {
   cd $_pkgname-$pkgver


=====================================
moto-5.x.diff
=====================================
@@ -0,0 +1,31 @@
+diff --git a/tests/moto_server.py b/tests/moto_server.py
+index 7807401..8ce738a 100644
+--- a/tests/moto_server.py
++++ b/tests/moto_server.py
+@@ -28,6 +28,17 @@ def get_free_tcp_port(release_socket: bool = False):
+     return sckt, port
+ 
+ 
++class DomainDispatcherApplication(moto.server.DomainDispatcherApplication):
++    def __init__(self, create_app, service):
++        super().__init__(create_app)
++        self.service = service
++
++    def get_backend_for_host(self, host):
++        if self.service:
++            return self.service
++
++        return super().get_backend_for_host(host)
++
+ class MotoService:
+     """Will Create MotoService.
+     Service is ref-counted so there will only be one per process. Real 
Service will
+@@ -94,7 +105,7 @@ class MotoService:
+             await self._stop()
+ 
+     def _server_entry(self):
+-        self._main_app = moto.server.DomainDispatcherApplication(
++        self._main_app = DomainDispatcherApplication(
+             moto.server.create_backend_app, service=self._service_name
+         )
+         self._main_app.debug = True



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-aiobotocore/-/commit/c540dac79b758c4f256884f7043fb0775757d02a

-- 
This project does not include diff previews in email notifications.
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-aiobotocore/-/commit/c540dac79b758c4f256884f7043fb0775757d02a
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to