Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-mocket for openSUSE:Factory 
checked in at 2023-01-10 14:58:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mocket (Old)
 and      /work/SRC/openSUSE:Factory/.python-mocket.new.32243 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-mocket"

Tue Jan 10 14:58:49 2023 rev:24 rq:1046032 version:3.10.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-mocket/python-mocket.changes      
2022-07-26 19:42:10.976586827 +0200
+++ /work/SRC/openSUSE:Factory/.python-mocket.new.32243/python-mocket.changes   
2023-01-10 14:58:49.480889785 +0100
@@ -1,0 +2,23 @@
+Sun Jan  1 18:43:24 UTC 2023 - Ben Greiner <c...@bnavigator.de>
+
+- Update to version 3.10.9
+  * Small improvement for socketpair by @mindflayer in #189
+  * Fix for an unconvential usage of Mocket by @mindflayer in #192
+  * Improve efficiency on CI by @amotl in #194
+- Add missing fastapi test dependency
+
+-------------------------------------------------------------------
+Tue Aug 23 18:47:07 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- update to version 3.10.8:
+ - Support for calls made by fastapi (#188)
+  * Introduce a `socket.socketpair()` function that acts as the real one
+
+-------------------------------------------------------------------
+Wed Aug 17 10:09:41 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- update to version 3.10.7:
+ - Adding support for `httpx` (#183)
+ - Change methods not using its bound instance to staticmethods (#180)
+
+-------------------------------------------------------------------

Old:
----
  mocket-3.10.6.tar.gz

New:
----
  mocket-3.10.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-mocket.spec ++++++
--- /var/tmp/diff_new_pack.m3M51h/_old  2023-01-10 14:58:50.492895202 +0100
+++ /var/tmp/diff_new_pack.m3M51h/_new  2023-01-10 14:58:50.508895288 +0100
@@ -1,7 +1,7 @@
 #
 # spec file
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,10 +24,10 @@
 %define psuffix %{nil}
 %bcond_with test
 %endif
-%{?!python_module:%define python_module() python3-%{**}}
+
 %define skip_python2 1
 Name:           python-mocket%{psuffix}
-Version:        3.10.6
+Version:        3.10.9
 Release:        0
 Summary:        Python socket mock framework
 License:        BSD-3-Clause
@@ -46,6 +46,7 @@
 %if %{with test}
 BuildRequires:  %{python_module aiohttp}
 BuildRequires:  %{python_module async_timeout}
+BuildRequires:  %{python_module fastapi}
 BuildRequires:  %{python_module gevent}
 BuildRequires:  %{python_module mocket = %{version}}
 BuildRequires:  %{python_module pook >= 0.2.1}

++++++ mocket-3.10.6.tar.gz -> mocket-3.10.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/PKG-INFO new/mocket-3.10.9/PKG-INFO
--- old/mocket-3.10.6/PKG-INFO  2022-05-17 21:03:53.772195000 +0200
+++ new/mocket-3.10.9/PKG-INFO  2022-12-03 23:22:43.329145000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: mocket
-Version: 3.10.6
+Version: 3.10.9
 Summary: Socket Mock Framework - for all kinds of socket animals, web-clients 
included -         with gevent/asyncio/SSL support
 Home-page: https://github.com/mindflayer/python-mocket
 Author: Giorgio Salluzzo
@@ -14,6 +14,7 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development
@@ -51,12 +52,13 @@
 Outside GitHub
 ==============
 
-Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_ and `NixOS`_.
+Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_, `NixOS`_ and `ALT Linux`_.
 
 .. _`@felixonmars`: https://github.com/felixonmars
 .. _`Arch Linux repository`: 
https://www.archlinux.org/packages/community/any/python-mocket/
 .. _`openSUSE`: https://software.opensuse.org/package/python-mocket
 .. _`NixOS`: https://search.nixos.org/packages?query=mocket
+.. _`ALT Linux`: 
https://packages.altlinux.org/en/sisyphus/srpms/python3-module-mocket/
 
 Versioning
 ==========
@@ -69,7 +71,7 @@
 *Star* the project on GitHub, *Buy Me a Coffee* clicking the button below or, 
even better, contribute with patches or documentation.
 
 .. image:: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
-     :target: https://www.buymeacoffee.com/mULbInw5z
+     :target: https://www.buymeacoffee.com/mocket
      :alt: Buy Me A Coffee
 
 How to use it
@@ -80,6 +82,7 @@
 - https://hackernoon.com/make-development-great-again-faab769d264e
 - https://hackernoon.com/httpretty-now-supports-asyncio-e310814704c6
 - 
https://medium.com/@mindflayer/how-to-make-your-tests-fail-when-they-try-to-access-the-network-python-eb80090a6d24
+- https://medium.com/@mindflayer/testing-in-an-asyncio-world-a9a0ad41b0c5
 
 The starting point to understand how to use *Mocket* to write a custom mock is 
the following example:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/README.rst new/mocket-3.10.9/README.rst
--- old/mocket-3.10.6/README.rst        2022-04-27 19:42:15.000000000 +0200
+++ new/mocket-3.10.9/README.rst        2022-12-03 23:22:22.000000000 +0100
@@ -24,12 +24,13 @@
 Outside GitHub
 ==============
 
-Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_ and `NixOS`_.
+Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_, `NixOS`_ and `ALT Linux`_.
 
 .. _`@felixonmars`: https://github.com/felixonmars
 .. _`Arch Linux repository`: 
https://www.archlinux.org/packages/community/any/python-mocket/
 .. _`openSUSE`: https://software.opensuse.org/package/python-mocket
 .. _`NixOS`: https://search.nixos.org/packages?query=mocket
+.. _`ALT Linux`: 
https://packages.altlinux.org/en/sisyphus/srpms/python3-module-mocket/
 
 Versioning
 ==========
@@ -42,7 +43,7 @@
 *Star* the project on GitHub, *Buy Me a Coffee* clicking the button below or, 
even better, contribute with patches or documentation.
 
 .. image:: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
-     :target: https://www.buymeacoffee.com/mULbInw5z
+     :target: https://www.buymeacoffee.com/mocket
      :alt: Buy Me A Coffee
 
 How to use it
@@ -53,6 +54,7 @@
 - https://hackernoon.com/make-development-great-again-faab769d264e
 - https://hackernoon.com/httpretty-now-supports-asyncio-e310814704c6
 - 
https://medium.com/@mindflayer/how-to-make-your-tests-fail-when-they-try-to-access-the-network-python-eb80090a6d24
+- https://medium.com/@mindflayer/testing-in-an-asyncio-world-a9a0ad41b0c5
 
 The starting point to understand how to use *Mocket* to write a custom mock is 
the following example:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/mocket/__init__.py 
new/mocket-3.10.9/mocket/__init__.py
--- old/mocket-3.10.6/mocket/__init__.py        2022-05-17 21:03:18.000000000 
+0200
+++ new/mocket-3.10.9/mocket/__init__.py        2022-12-03 23:22:22.000000000 
+0100
@@ -3,4 +3,4 @@
 
 __all__ = ("async_mocketize", "mocketize", "Mocket", "MocketEntry", 
"Mocketizer")
 
-__version__ = "3.10.6"
+__version__ = "3.10.9"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/mocket/mocket.py 
new/mocket-3.10.9/mocket/mocket.py
--- old/mocket-3.10.6/mocket/mocket.py  2022-04-25 08:49:46.000000000 +0200
+++ new/mocket-3.10.9/mocket/mocket.py  2022-12-03 23:22:22.000000000 +0100
@@ -51,6 +51,7 @@
 true_gethostbyname = socket.gethostbyname
 true_gethostname = socket.gethostname
 true_getaddrinfo = socket.getaddrinfo
+true_socketpair = socket.socketpair
 true_ssl_wrap_socket = ssl.wrap_socket
 true_ssl_socket = ssl.SSLSocket
 true_ssl_context = ssl.SSLContext
@@ -76,6 +77,7 @@
         "load_default_certs",
         "load_verify_locations",
         "set_alpn_protocols",
+        "set_ciphers",
     )
     sock = None
     post_handshake_auth = None
@@ -135,6 +137,13 @@
     return s
 
 
+def socketpair(*args, **kwargs):
+    """Returns a real socketpair() used by asyncio loop for supporting calls 
made by fastapi and similar services."""
+    import _socket
+
+    return _socket.socketpair(*args, **kwargs)
+
+
 def _hash_request(h, req):
     return h(encode_to_bytes("".join(sorted(req.split("\r\n"))))).hexdigest()
 
@@ -412,6 +421,7 @@
 
 
 class Mocket:
+    _address = (None, None)
     _entries = collections.defaultdict(list)
     _requests = []
     _namespace = text_type(id(_entries))
@@ -426,6 +436,8 @@
 
     @classmethod
     def get_entry(cls, host, port, data):
+        host = host or Mocket._address[0]
+        port = port or Mocket._address[1]
         entries = cls._entries.get((host, port), [])
         for entry in entries:
             if entry.can_handle(data):
@@ -485,6 +497,7 @@
         ] = lambda host, port, family=None, socktype=None, proto=None, 
flags=None: [
             (2, 1, 6, "", (host, port))
         ]
+        socket.socketpair = socket.__dict__["socketpair"] = socketpair
         ssl.wrap_socket = ssl.__dict__["wrap_socket"] = 
FakeSSLContext.wrap_socket
         ssl.SSLContext = ssl.__dict__["SSLContext"] = FakeSSLContext
         socket.inet_pton = socket.__dict__["inet_pton"] = lambda family, ip: 
byte_type(
@@ -517,6 +530,7 @@
         socket.gethostname = socket.__dict__["gethostname"] = true_gethostname
         socket.gethostbyname = socket.__dict__["gethostbyname"] = 
true_gethostbyname
         socket.getaddrinfo = socket.__dict__["getaddrinfo"] = true_getaddrinfo
+        socket.socketpair = socket.__dict__["socketpair"] = true_socketpair
         ssl.wrap_socket = ssl.__dict__["wrap_socket"] = true_ssl_wrap_socket
         ssl.SSLContext = ssl.__dict__["SSLContext"] = true_ssl_context
         socket.inet_pton = socket.__dict__["inet_pton"] = true_inet_pton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/mocket/plugins/pook_mock_engine.py 
new/mocket-3.10.9/mocket/plugins/pook_mock_engine.py
--- old/mocket-3.10.6/mocket/plugins/pook_mock_engine.py        2021-03-20 
19:51:56.000000000 +0100
+++ new/mocket-3.10.9/mocket/plugins/pook_mock_engine.py        2022-05-18 
14:31:33.000000000 +0200
@@ -28,11 +28,13 @@
 
 
 class MocketInterceptor(BaseInterceptor):
-    def activate(self):
+    @staticmethod
+    def activate():
         Mocket.disable()
         Mocket.enable()
 
-    def disable(self):
+    @staticmethod
+    def disable():
         Mocket.disable()
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/mocket.egg-info/PKG-INFO 
new/mocket-3.10.9/mocket.egg-info/PKG-INFO
--- old/mocket-3.10.6/mocket.egg-info/PKG-INFO  2022-05-17 21:03:53.000000000 
+0200
+++ new/mocket-3.10.9/mocket.egg-info/PKG-INFO  2022-12-03 23:22:43.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: mocket
-Version: 3.10.6
+Version: 3.10.9
 Summary: Socket Mock Framework - for all kinds of socket animals, web-clients 
included -         with gevent/asyncio/SSL support
 Home-page: https://github.com/mindflayer/python-mocket
 Author: Giorgio Salluzzo
@@ -14,6 +14,7 @@
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development
@@ -51,12 +52,13 @@
 Outside GitHub
 ==============
 
-Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_ and `NixOS`_.
+Thanks to `@felixonmars`_, Mocket is available in the `Arch Linux 
repository`_. It's also packaged for `openSUSE`_, `NixOS`_ and `ALT Linux`_.
 
 .. _`@felixonmars`: https://github.com/felixonmars
 .. _`Arch Linux repository`: 
https://www.archlinux.org/packages/community/any/python-mocket/
 .. _`openSUSE`: https://software.opensuse.org/package/python-mocket
 .. _`NixOS`: https://search.nixos.org/packages?query=mocket
+.. _`ALT Linux`: 
https://packages.altlinux.org/en/sisyphus/srpms/python3-module-mocket/
 
 Versioning
 ==========
@@ -69,7 +71,7 @@
 *Star* the project on GitHub, *Buy Me a Coffee* clicking the button below or, 
even better, contribute with patches or documentation.
 
 .. image:: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
-     :target: https://www.buymeacoffee.com/mULbInw5z
+     :target: https://www.buymeacoffee.com/mocket
      :alt: Buy Me A Coffee
 
 How to use it
@@ -80,6 +82,7 @@
 - https://hackernoon.com/make-development-great-again-faab769d264e
 - https://hackernoon.com/httpretty-now-supports-asyncio-e310814704c6
 - 
https://medium.com/@mindflayer/how-to-make-your-tests-fail-when-they-try-to-access-the-network-python-eb80090a6d24
+- https://medium.com/@mindflayer/testing-in-an-asyncio-world-a9a0ad41b0c5
 
 The starting point to understand how to use *Mocket* to write a custom mock is 
the following example:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/mocket.egg-info/SOURCES.txt 
new/mocket-3.10.9/mocket.egg-info/SOURCES.txt
--- old/mocket-3.10.6/mocket.egg-info/SOURCES.txt       2022-05-17 
21:03:53.000000000 +0200
+++ new/mocket-3.10.9/mocket.egg-info/SOURCES.txt       2022-12-03 
23:22:43.000000000 +0100
@@ -37,6 +37,7 @@
 
tests/main/tests.main.test_http_gevent.GeventHttpEntryTestCase.test_truesendall_with_dump_from_recording.json
 
tests/main/tests.main.test_http_with_xxhash.HttpEntryTestCase.test_truesendall_with_dump_from_recording.json
 tests/tests37/test_asyncio.py
+tests/tests37/test_httpx.py
 tests/tests38/README.txt
 tests/tests38/__init__.py
 tests/tests38/test_http_aiohttp.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/setup.py new/mocket-3.10.9/setup.py
--- old/mocket-3.10.6/setup.py  2022-01-08 13:36:13.000000000 +0100
+++ new/mocket-3.10.9/setup.py  2022-08-11 14:47:42.000000000 +0200
@@ -56,6 +56,7 @@
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: Software Development",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/tests/main/test_redis.py 
new/mocket-3.10.9/tests/main/test_redis.py
--- old/mocket-3.10.6/tests/main/test_redis.py  2022-01-08 17:50:17.000000000 
+0100
+++ new/mocket-3.10.9/tests/main/test_redis.py  2022-05-18 14:31:33.000000000 
+0200
@@ -87,7 +87,8 @@
             Mocket._entries[("localhost", 6379)][0].responses[0].data, 
b"+OK\r\n"
         )
 
-    def test_register_response(self):
+    @staticmethod
+    def test_register_response():
         Entry.register_response(command='SET snowman "is ☃!"', response="")
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mocket-3.10.6/tests/tests37/test_httpx.py 
new/mocket-3.10.9/tests/tests37/test_httpx.py
--- old/mocket-3.10.6/tests/tests37/test_httpx.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/mocket-3.10.9/tests/tests37/test_httpx.py       2022-08-23 
17:53:18.000000000 +0200
@@ -0,0 +1,77 @@
+import json
+
+import httpx
+import pytest
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+
+from mocket import Mocketizer, async_mocketize, mocketize
+from mocket.mockhttp import Entry
+
+
+@pytest.mark.asyncio
+@async_mocketize
+async def test_httpx_decorator():
+    url = "https://bar.foo/";
+    data = {"message": "Hello"}
+
+    Entry.single_register(
+        Entry.GET,
+        url,
+        body=json.dumps(data),
+        headers={"content-type": "application/json"},
+    )
+
+    async with httpx.AsyncClient() as client:
+        response = await client.get(url)
+
+        assert response.json() == data
+
+
+@pytest.fixture
+def httpx_client() -> httpx.AsyncClient:
+    with Mocketizer():
+        yield httpx.AsyncClient()
+
+
+@pytest.mark.asyncio
+async def test_httpx_fixture(httpx_client):
+    url = "https://foo.bar/";
+    data = {"message": "Hello"}
+
+    Entry.single_register(
+        Entry.GET,
+        url,
+        body=json.dumps(data),
+        headers={"content-type": "application/json"},
+    )
+
+    async with httpx_client as client:
+        response = await client.get(url)
+
+        assert response.json() == data
+
+
+def create_app() -> FastAPI:
+    app = FastAPI()
+
+    @app.get("/")
+    async def read_main() -> dict:
+        async with httpx.AsyncClient() as client:
+            r = await client.get("https://example.org/";)
+            return r.json()
+
+    return app
+
+
+@mocketize
+def test_call_from_fastapi() -> None:
+    app = create_app()
+    client = TestClient(app)
+
+    Entry.single_register(Entry.GET, "https://example.org/";, body='{"id": 1}')
+
+    response = client.get("/")
+
+    assert response.status_code == 200
+    assert response.json() == {"id": 1}

Reply via email to