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 2026-11-27 19:40:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mocket (Old) and /work/SRC/openSUSE:Factory/.python-mocket.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mocket" Fri Nov 27 19:40:28 2026 rev:53 rq:1400425 version:3.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mocket/python-mocket.changes 2026-09-10 11:47:05.698762498 +0200 +++ /work/SRC/openSUSE:Factory/.python-mocket.new.1340718/python-mocket.changes 2026-11-27 19:40:46.022131063 +0100 @@ -1,0 +2,11 @@ +Wed Nov 25 00:48:33 UTC 2026 - Steve Kowalik <[email protected]> + +- Update to 3.15.1: + * Pin right version for typing-extensions + * Preserve encoded query parameters in recorded requests + * Add Python 3.15 support + * Fix socketpair() on platforms without _socket.socketpair +- Add patch support-redis-8.2.patch: + * Support redis-py 8.2.0+. + +------------------------------------------------------------------- Old: ---- mocket-3.14.4.tar.gz New: ---- mocket-3.15.1.tar.gz support-redis-8.2.patch ----------(New B)---------- New: * Fix socketpair() on platforms without _socket.socketpair - Add patch support-redis-8.2.patch: * Support redis-py 8.2.0+. ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mocket.spec ++++++ --- /var/tmp/diff_new_pack.dJkzcx/_old 2026-11-27 19:40:47.333185603 +0100 +++ /var/tmp/diff_new_pack.dJkzcx/_new 2026-11-27 19:40:47.336185728 +0100 @@ -36,16 +36,17 @@ %{?sle15_python_module_pythons} Name: python-mocket%{psuffix} -Version: 3.14.4 +Version: 3.15.1 Release: 0 Summary: Python socket mock framework License: BSD-3-Clause URL: https://github.com/mindflayer/python-mocket Source0: https://files.pythonhosted.org/packages/source/m/mocket/mocket-%{version}.tar.gz +# PATCH-FIX-OPENSUSE Use RESP2 (protocol=2) in RedisTestCase for redis-py >= 8.2.0 +Patch0: support-redis-8.2.patch +BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module hatchling} BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-decorator >= 4 @@ -113,12 +114,6 @@ # Checks the ability to record a real request and response. Not available inside obs. donttest="test_asyncio_record_replay or test_truesendall_with_dump_from_recording or test_no_dangling_fds" -# The reference recording has different headers in this case -%if %{pkg_vcmp %{mypython}-httpx < 0.23} -donttest="$donttest or test_truesendall_with_dump_from_recording" -%endif -# fails with new incompatible aiohttp version https://github.com/mindflayer/python-mocket/issues/247 -donttest="$donttest or test_aiohttp" %pytest -rfEs -k "not ($donttest)" ${pytest_$python_ignore} tests %endif ++++++ mocket-3.14.4.tar.gz -> mocket-3.15.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/PKG-INFO new/mocket-3.15.1/PKG-INFO --- old/mocket-3.14.4/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.5 Name: mocket -Version: 3.14.4 +Version: 3.15.1 Summary: Socket Mock Framework - for all kinds of socket animals, web-clients included - with gevent/asyncio/SSL support Project-URL: Homepage, https://pypi.org/project/mocket Project-URL: Repository, https://github.com/mindflayer/python-mocket @@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3.15 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development @@ -26,7 +27,7 @@ Requires-Dist: decorator>=4.0.0 Requires-Dist: h11 Requires-Dist: puremagic -Requires-Dist: typing-extensions +Requires-Dist: typing-extensions>=4.6.0 Requires-Dist: urllib3>=1.25.3 Provides-Extra: pook Requires-Dist: pook>=0.2.1; extra == 'pook' @@ -107,13 +108,13 @@ Outside GitHub ============== -Mocket packages are available for `openSUSE`_, `NixOS`_, `ALT Linux`_, `NetBSD`_, `AUR Arch Linux`_, and of course from `PyPI`_. +Mocket packages are available for `openSUSE`_, `NixOS`_, `ALT Linux`_, `NetBSD`_, `Arch Linux`_, and of course from `PyPI`_. .. _`openSUSE`: https://software.opensuse.org/search?baseproject=ALL&q=mocket .. _`NixOS`: https://search.nixos.org/packages?query=mocket .. _`ALT Linux`: https://packages.altlinux.org/en/sisyphus/srpms/python3-module-mocket/ .. _`NetBSD`: https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/py-mocket/index.html -.. _`AUR Arch Linux`: https://aur.archlinux.org/packages/python-mocket +.. _`Arch Linux`: https://archlinux.org/packages/extra/any/python-mocket/ .. _`PyPI`: https://pypi.org/project/mocket/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/README.rst new/mocket-3.15.1/README.rst --- old/mocket-3.14.4/README.rst 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/README.rst 2020-02-02 01:00:00.000000000 +0100 @@ -47,13 +47,13 @@ Outside GitHub ============== -Mocket packages are available for `openSUSE`_, `NixOS`_, `ALT Linux`_, `NetBSD`_, `AUR Arch Linux`_, and of course from `PyPI`_. +Mocket packages are available for `openSUSE`_, `NixOS`_, `ALT Linux`_, `NetBSD`_, `Arch Linux`_, and of course from `PyPI`_. .. _`openSUSE`: https://software.opensuse.org/search?baseproject=ALL&q=mocket .. _`NixOS`: https://search.nixos.org/packages?query=mocket .. _`ALT Linux`: https://packages.altlinux.org/en/sisyphus/srpms/python3-module-mocket/ .. _`NetBSD`: https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/py-mocket/index.html -.. _`AUR Arch Linux`: https://aur.archlinux.org/packages/python-mocket +.. _`Arch Linux`: https://archlinux.org/packages/extra/any/python-mocket/ .. _`PyPI`: https://pypi.org/project/mocket/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/mocket/__init__.py new/mocket-3.15.1/mocket/__init__.py --- old/mocket-3.14.4/mocket/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/mocket/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -33,4 +33,4 @@ "FakeSSLContext", ) -__version__ = "3.14.4" +__version__ = "3.15.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/mocket/mocks/mockhttp.py new/mocket-3.15.1/mocket/mocks/mockhttp.py --- old/mocket-3.14.4/mocket/mocks/mockhttp.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/mocket/mocks/mockhttp.py 2020-02-02 01:00:00.000000000 +0100 @@ -7,7 +7,7 @@ from functools import cached_property from http.server import BaseHTTPRequestHandler from typing import Any, Callable -from urllib.parse import parse_qs, unquote, urlsplit +from urllib.parse import parse_qs, urlsplit from h11 import SERVER, Connection, Data from h11 import Request as H11Request @@ -90,11 +90,7 @@ Dictionary of query parameter names to lists of values """ parts = self.path.split("?", 1) - return ( - parse_qs(unquote(parts[1]), keep_blank_values=True) - if len(parts) == 2 - else {} - ) + return parse_qs(parts[1], keep_blank_values=True) if len(parts) == 2 else {} @cached_property def body(self) -> str: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/mocket/socket.py new/mocket-3.15.1/mocket/socket.py --- old/mocket-3.14.4/mocket/socket.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/mocket/socket.py 2020-02-02 01:00:00.000000000 +0100 @@ -107,6 +107,69 @@ return bytes("\x7f\x00\x00\x01", "utf-8") +def _loopback_socketpair( + family: int = socket.AF_INET, + socktype: int = socket.SOCK_STREAM, + proto: int = 0, +) -> tuple[socket.socket, socket.socket]: + """Build a connected pair of real sockets over the IPv4/IPv6 loopback. + + Windows has no ``_socket.socketpair()``; the standard library builds the + pair in Python instead. That code path resolves the module-level ``socket`` + name, which Mocket has already swapped for :class:`MocketSocket`, so the + pair is assembled here from ``true_socket`` to keep it out of the mock + layer. Only the loopback connection used by the event loop ends up here. + """ + if family == socket.AF_INET: + host = "127.0.0.1" + elif family == socket.AF_INET6: + host = "::1" + else: + raise ValueError( + f"Only AF_INET and AF_INET6 address families are supported: {family}" + ) + if socktype != socket.SOCK_STREAM: + raise ValueError(f"Only SOCK_STREAM socket type is supported: {socktype}") + if proto != 0: + raise ValueError(f"Only protocol zero is supported: {proto}") + + lsock = true_socket(family, socktype, proto) + try: + lsock.bind((host, 0)) + lsock.listen() + addr, port = lsock.getsockname()[:2] + csock = true_socket(family, socktype, proto) + try: + csock.setblocking(False) + with contextlib.suppress(BlockingIOError, InterruptedError): + csock.connect((addr, port)) + csock.setblocking(True) + # accept() would wrap the descriptor back into MocketSocket. + fd, _peer = lsock._accept() + ssock = true_socket(family, socktype, proto, fileno=fd) + except Exception: + csock.close() + raise + finally: + lsock.close() + + # Same check CPython added in its fallback for CVE-2024-3219: the listener + # is reachable from outside the process, so make sure the peer we accepted + # is our own csock and not somebody else that connected first. + try: + if ( + ssock.getsockname() != csock.getpeername() + or csock.getsockname() != ssock.getpeername() + ): + raise ConnectionError("Unexpected peer connection") + except Exception: + ssock.close() + csock.close() + raise + + return ssock, csock + + def mock_socketpair( *args: Any, **kwargs: Any, @@ -125,7 +188,10 @@ """ import _socket - return _socket.socketpair(*args, **kwargs) + if hasattr(_socket, "socketpair"): + return _socket.socketpair(*args, **kwargs) + + return _loopback_socketpair(*args, **kwargs) class MocketSocket: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/pyproject.toml new/mocket-3.15.1/pyproject.toml --- old/mocket-3.14.4/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -23,6 +23,7 @@ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", @@ -34,7 +35,7 @@ "decorator>=4.0.0", "urllib3>=1.25.3", "h11", - "typing-extensions", + "typing-extensions>=4.6.0", ] dynamic = ["version"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/tests/test_http.py new/mocket-3.15.1/tests/test_http.py --- old/mocket-3.14.4/tests/test_http.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/tests/test_http.py 2020-02-02 01:00:00.000000000 +0100 @@ -15,6 +15,49 @@ from mocket.mocks.mockhttp import Entry, Response [email protected]( + ("query", "expected"), + [ + ("q=one%26two", {"q": ["one&two"]}), + ("q=one%2Btwo", {"q": ["one+two"]}), + ("q=%2526", {"q": ["%26"]}), + ("field%26name=value", {"field&name": ["value"]}), + ("field%3Dname=value", {"field=name": ["value"]}), + ("q=%25E2%2582%25AC", {"q": ["%E2%82%AC"]}), + ("q=one+two", {"q": ["one two"]}), + ("q=one%20two", {"q": ["one two"]}), + ("q=%E2%82%AC", {"q": ["\u20ac"]}), + ("q=&q=next&bare&empty=", {"q": ["", "next"], "bare": [""], "empty": [""]}), + ("", {}), + (None, {}), + ], +) +def test_request_querystring_uses_form_urlencoded_semantics(query, expected): + path = "/" if query is None else f"/?{query}" + url = f"http://testme.org{path}" + with Mocketizer(strict_mode=True): + Entry.single_register(Entry.GET, url, body="ok") + with requests.get(url, timeout=5) as response: + assert response.content == b"ok" + assert Mocket.last_request().querystring == expected + + [email protected]("scheme", ["http", "https"]) +def test_recorded_querystring(scheme): + parameters = [("field&name", "a+b&c=%26"), ("q", ""), ("q", "\u20ac")] + url = f"{scheme}://testme.org/?{urlencode(parameters)}" + + with Mocketizer(strict_mode=True): + Entry.single_register(Entry.GET, url, body="ok") + with requests.get(url, timeout=5) as response: + assert response.content == b"ok" + + assert Mocket.last_request().querystring == { + "field&name": ["a+b&c=%26"], + "q": ["", "\u20ac"], + } + + class HttpTestCase(TestCase): def assertEqualHeaders(self, first, second, msg=None): first = {k.lower(): v for k, v in first.items()} @@ -27,8 +70,8 @@ @mocketize def test_truesendall(self): url = "http://httpbin.local/ip" - resp = urlopen(url) - self.assertEqual(resp.code, 200) + with urlopen(url) as resp: + self.assertEqual(resp.code, 200) resp = requests.get(url) self.assertEqual(resp.status_code, 200) @@ -38,10 +81,11 @@ ): url = "http://httpbin.local/ip" - urlopen(url) + with urlopen(url): + pass requests.get(url) - resp = urlopen(url) - self.assertEqual(resp.code, 200) + with urlopen(url) as resp: + self.assertEqual(resp.code, 200) resp = requests.get(url) self.assertEqual(resp.status_code, 200) assert "origin" in resp.json() @@ -190,10 +234,10 @@ Entry.GET, "http://testme.org/", Response(status=404), Response() ) self.assertRaises(HTTPError, urlopen, "http://testme.org/") - response = urlopen("http://testme.org/") - self.assertEqual(response.code, 200) - response = urlopen("http://testme.org/") - self.assertEqual(response.code, 200) + with urlopen("http://testme.org/") as response: + self.assertEqual(response.code, 200) + with urlopen("http://testme.org/") as response: + self.assertEqual(response.code, 200) self.assertEqual(len(Mocket.request_list()), 3) @mocketize diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/tests/test_httpx.py new/mocket-3.15.1/tests/test_httpx.py --- old/mocket-3.14.4/tests/test_httpx.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/tests/test_httpx.py 2020-02-02 01:00:00.000000000 +0100 @@ -26,7 +26,7 @@ assert response.status_code == 404 assert response.text == body - response = await client.post(url, data=body * 6) + response = await client.post(url, content=body * 6) assert response.status_code == 201 assert response.text == body * 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/tests/test_redis.py new/mocket-3.15.1/tests/test_redis.py --- old/mocket-3.14.4/tests/test_redis.py 2020-02-02 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/tests/test_redis.py 2020-02-02 01:00:00.000000000 +0100 @@ -126,7 +126,7 @@ @mocketize def test_hm(self): h = {b"f1": b"one", b"f2": b"two"} - self.assertTrue(self.rclient.hmset("hash", h)) + self.assertEqual(self.rclient.hset("hash", mapping=h), len(h)) self.assertEqual(self.rclient.hgetall("hash"), h) @mocketize diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mocket-3.14.4/tests/test_socketpair.py new/mocket-3.15.1/tests/test_socketpair.py --- old/mocket-3.14.4/tests/test_socketpair.py 1970-01-01 01:00:00.000000000 +0100 +++ new/mocket-3.15.1/tests/test_socketpair.py 2020-02-02 01:00:00.000000000 +0100 @@ -0,0 +1,209 @@ +import asyncio +import socket + +import pytest + +from mocket import Mocketizer +from mocket.socket import MocketSocket, _loopback_socketpair, mock_socketpair + + +def test_socketpair_returns_a_real_connected_pair(): + """socketpair() must keep working while Mocket is enabled. + + On Windows there is no C-level socketpair(), and the standard library + fallback resolves the module-level ``socket`` name, which Mocket has + swapped for MocketSocket. The pair therefore has to be built from the real + socket class. + """ + with Mocketizer(): + a, b = socket.socketpair() + try: + a.send(b"ping") + assert b.recv(4) == b"ping" + b.send(b"pong") + assert a.recv(4) == b"pong" + finally: + a.close() + b.close() + + +def test_asyncio_event_loop_can_be_created(): + """asyncio creates its self-pipe with socketpair() when a loop is built.""" + with Mocketizer(): + loop = asyncio.new_event_loop() + try: + assert loop is not None + finally: + loop.close() + + +def test_socketpair_does_not_disable_the_mock_layer(): + """The loopback pair must not leak past socketpair() into user sockets.""" + with Mocketizer(): + a, b = socket.socketpair() + a.close() + b.close() + + assert socket.socket is MocketSocket + assert not isinstance(a, MocketSocket) + + +def test_mock_socketpair_without_the_c_function(monkeypatch): + """Force the pure-Python path so POSIX CI covers it too.""" + import _socket + + monkeypatch.delattr(_socket, "socketpair", raising=False) + + with Mocketizer(): + a, b = socket.socketpair() + try: + a.send(b"ping") + assert b.recv(4) == b"ping" + finally: + a.close() + b.close() + + loop = asyncio.new_event_loop() + loop.close() + + +def test_loopback_socketpair_rejects_a_foreign_peer(monkeypatch): + """CVE-2024-3219: the listener is reachable, so the peer must be ours. + + The hijack has to be installed on ``mocket.socket.true_socket``, which is + the name ``_loopback_socketpair`` resolves. Patching ``socket.socket`` + instead only works while that name still points at the same class: the + gevent tests in this suite call ``monkey.patch_socket()`` at import time, + which leaves ``socket.socket`` bound to gevent's subclass while + ``true_socket`` keeps the original one, so the hijack silently missed. + """ + from mocket import socket as mocket_socket_module + from mocket.socket import _loopback_socketpair + + real = mocket_socket_module.true_socket + listener = real(socket.AF_INET, socket.SOCK_STREAM) + listener.bind(("127.0.0.1", 0)) + listener.listen(1) + attacker = real(socket.AF_INET, socket.SOCK_STREAM) + attacker.connect(listener.getsockname()) + hijacked, foreign_peer = listener.accept() + hijacked_fd = hijacked.detach() + + class HijackedListener(real): + def _accept(self): + # _loopback_socketpair() connects with setblocking(False), exactly + # like CPython's own fallback, and relies on accept() to wait for + # the handshake before the peer check calls getpeername(). Linux + # leaves that connect in SYN_SENT for a moment, so skipping the + # wait here makes getpeername() raise ENOTCONN instead of the + # ConnectionError this test is about. Drain the real connection + # first; its peer is nobody we care about. + # Socket._accept() is CPython-internal and missing from the type + # stubs, hence the ignore: it is the only way to bypass the + # override above without recursing through accept(). + real_fd, _ = real._accept(self) # type: ignore[attr-defined] + # Wrap it before closing: on Windows a socket descriptor is not + # an OS file descriptor, so os.close() would raise EBADF. + real(fileno=real_fd).close() + return hijacked_fd, foreign_peer + + monkeypatch.setattr(mocket_socket_module, "true_socket", HijackedListener) + try: + with pytest.raises(ConnectionError, match="Unexpected peer connection"): + _loopback_socketpair() + finally: + listener.close() + attacker.close() + + +def test_mock_socketpair_prefers_the_c_implementation(monkeypatch): + """When the interpreter has _socket.socketpair() there is nothing to build.""" + import _socket + + sentinel = (object(), object()) + monkeypatch.setattr( + _socket, "socketpair", lambda *args, **kwargs: sentinel, raising=False + ) + + assert mock_socketpair() is sentinel + + +def test_loopback_socketpair_works_over_ipv6(): + """AF_INET6 is served from ::1; the pair must be just as usable as IPv4.""" + probe = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) + try: + probe.bind(("::1", 0)) + except OSError: + pytest.skip("IPv6 loopback is not available") + finally: + probe.close() + + a, b = _loopback_socketpair(socket.AF_INET6) + try: + a.send(b"ping") + assert b.recv(4) == b"ping" + finally: + a.close() + b.close() + + [email protected]( + ("kwargs", "message"), + [ + ({"family": socket.AF_UNSPEC}, "Only AF_INET and AF_INET6 address families"), + ({"socktype": socket.SOCK_DGRAM}, "Only SOCK_STREAM socket type"), + ({"proto": 6}, "Only protocol zero"), + ], +) +def test_loopback_socketpair_rejects_unsupported_options(kwargs, message): + """Whatever the loopback fallback cannot honour is refused before binding.""" + with pytest.raises(ValueError, match=message): + _loopback_socketpair(**kwargs) + + +def test_loopback_socketpair_closes_the_client_when_accept_fails(monkeypatch): + """A failing accept() must not leak the socket that already connected.""" + from mocket import socket as mocket_socket_module + + real = mocket_socket_module.true_socket + created = [] + + class FailingListener(real): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + created.append(self) + + def _accept(self): + raise OSError("accept() failed") + + monkeypatch.setattr(mocket_socket_module, "true_socket", FailingListener) + with pytest.raises(OSError, match="accept"): + _loopback_socketpair() + + _listener, client = created + assert client.fileno() == -1 + + +def test_loopback_socketpair_closes_both_sockets_on_a_peer_mismatch(monkeypatch): + """CVE-2024-3219: when the peer is not ours, both halves are closed.""" + from mocket import socket as mocket_socket_module + + real = mocket_socket_module.true_socket + created = [] + + class DoctoredPeers(real): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + created.append(self) + + def getpeername(self): + host, port = super().getpeername() + return host, port + 1 + + monkeypatch.setattr(mocket_socket_module, "true_socket", DoctoredPeers) + with pytest.raises(ConnectionError, match="Unexpected peer connection"): + _loopback_socketpair() + + _listener, client, accepted = created + assert client.fileno() == -1 + assert accepted.fileno() == -1 ++++++ support-redis-8.2.patch ++++++ Index: mocket-3.15.1/tests/test_redis.py =================================================================== --- mocket-3.15.1.orig/tests/test_redis.py +++ mocket-3.15.1/tests/test_redis.py @@ -155,7 +155,7 @@ class TrueRedisTestCase(TestCase): class RedisTestCase(TestCase): def setUp(self): - self.rclient = redis.StrictRedis() + self.rclient = redis.StrictRedis(protocol=2) def mocketize_setup(self): Entry.register_response("CLIENT SETINFO LIB-NAME redis-py", OK)
