Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pook for openSUSE:Factory checked in at 2026-07-08 17:40:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pook (Old) and /work/SRC/openSUSE:Factory/.python-pook.new.1982 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pook" Wed Jul 8 17:40:32 2026 rev:10 rq:1364565 version:2.1.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pook/python-pook.changes 2025-06-03 17:57:25.147258043 +0200 +++ /work/SRC/openSUSE:Factory/.python-pook.new.1982/python-pook.changes 2026-07-08 17:42:44.538443497 +0200 @@ -1,0 +2,138 @@ +Wed Jul 8 13:44:01 UTC 2026 - Matej Cepl <[email protected]> + +- Update test requirements in spec file from pyproject.toml. +- Update fix_tests.patch: + - Fix test failures on Python 3.14/aiohttp >= 3.14.0 by supplying + stream_writer keyword argument conditionally. + - Fix test failures due to pytest assertion rewriting in + HeadersMatcher by replacing assert statements with explicit raises. + +------------------------------------------------------------------- +Sun Jul 5 19:01:33 UTC 2026 - Matej Cepl <[email protected]> + +- Add fix_tests.patch to substitute get_original() method + missing in unittest.mock.patch. + +------------------------------------------------------------------- +Wed Jul 1 16:34:42 UTC 2026 - Matej Cepl <[email protected]> + +- Update to 2.1.6: + - interceptors/http: fix version format + - interceptors/http: set length on response +- Update to 2.1.5: + - Fixing Flakiness in api_test.py + - Drop cpython 3.9 and pypy 3.10 + - Use aiohttp middleware for mocking +- Update to 2.1.4: + - Replace pytest-httpbin with minimal Falcon version + - Fix type of aiohttp raw headers + - Fix aiohttp tuple parameters handling +- Update to 2.1.3: + - Ensure aiohttp headers matchable from both session and request +- Update to 2.1.2: + - Return the correct type of headers object for standard library urllib + - Support Sequence[tuple[str, str]] header input with aiohttp + - Fix network filters when multiple filters are active + - Fix aiohttp matching not working with session base URL or headers + - Add support for Python 3.13 +- Update to 2.1.1: + - Flush mocks when pook.activate used as a wrapper; this + prevents mocks from leaking between test cases and should + fix some potentially confusing edge case bugs. +- Update to 2.1.0: + - Drop support for Python 3.8 +- Update to 2.0.1: + - Improve aiohttp JSONMatcher support +- Update to 2.0.0: + - Breaking change (see gh#h2non/pook#128 for details): Remove + Response::body's binary parameter and enforce a keyword + argument for chunked. + The binary parameter is no longer needed since + responses are now always byte-encoded in all cases (see + below). A keyword argument is now enforced for chunked + to ensure unnamed arguments meant for the removed + binary parameter cannot be confused as chunked + arguments. + - Only return byte-encoded response bodies, matching the + bahviour of all supported client libraries. + This is possible because for all supported client + libraries, pook mocks the actual response sent to the + client library over the wire, which will, in all cases, + be bytes. Client libraries that support reading + response content as a string or other formats will + continue to work as expected, because they'll always be + handling bytes from pook. + This causes no change to application code for users of + pook, except for users of the standard library urllib, + for which this also fixed a bug where non-bytes bodies + were returned by pook in certain cases. This is + impossible in real application code. If you rely on + pook to mock urllib responses and have code that + handles non-bytes response bodies, that code can be + safely deleted (provided the only reason it was there + was pook in the first place). + - Breaking change: Remove Mock::body's binary parameter. + This parameter was already unused due to a bug in the + code (it was not passed through to the BodyMatcher), so + this will not cause any changes to tests that relied on + it: it didn't do anything to begin with. The breaking + change is simply the removal of the unused parameter, + which should be deleted from tests using pook. Pook's + code has also been updated to remove all cases where + non-bytes objects were being handled. Instead, the body + of any interecepted request will always be stored as + bytes, and only decoded when necessary for individual + downstream matchers (JSON, XML). + - Correct documentation strings for XMLMatcher and + JSONMatcher to no longer suggest they can handle regex + matchers. These classes never implemented regex matching. + - Add a pytest fixture to the package (kudos @wimglenn) +- Update to 1.4.3: + - Fix httpx incorrectly named method on interceptor subclass +- Update to 1.4.2: + - fix #122: httpx streaming via iter_raw raises + httpx.StreamConsumed +- Update to 1.4.1: + - Fix Mock constructor params/url order mishandling + - Optionally match empty values in query parameter presence + matcher + - Fix #115, httpx network mode +- Update to 1.4.0: + - Enable mocket tests for >3.10 + - Add HTTPX support + - Set requires-python to fix build metadata + - Fix httpx reference in README and add build and dist check + to CI workflow +- Update to 1.3.0: + - Drop support for EOL'd Python versions (in other words, 3.6 + and 3.7) + - Use pyproject.toml + - Use ruff to lint files + - Use pre-commit to add pre-commit hooks + - Use hatch to manage test, development, and build + environments + - Fix the test configuration to actually run the example + tests + - Fix the documentation build + - Fix support for asynchronous functions in the activate + decorator (this was a direct result of re-enabling the + example tests and finding lots of little issues) + - Remove all mention of the unsupported pycurl library + - Clean up tests that can use pytest parametrize to do so + (and get better debugging information during tests runs as + a result) + - Use pytest-pook to clean up a bunch of unnecessary test + fixtures + - Fix deprecation warning for invalid string escape sequences + caused by untagged regex strings +- Update to 1.2.1: + - fix(regex): Fix usage of regex values in header matchers + - Fix urllib SSL handling +- Update to 1.2.0: + - Add support for true binary bodies + - Add examples and tests for matching query params + - urllib3 v2+ support + - Handle binary header field values + - More reliable test_post_with_headers + +------------------------------------------------------------------- Old: ---- pook-1.1.1.tar.gz New: ---- fix_tests.patch pook-2.1.6.tar.gz ----------(New B)---------- New:- Update test requirements in spec file from pyproject.toml. - Update fix_tests.patch: - Fix test failures on Python 3.14/aiohttp >= 3.14.0 by supplying ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pook.spec ++++++ --- /var/tmp/diff_new_pack.VCVUNU/_old 2026-07-08 17:42:45.162465225 +0200 +++ /var/tmp/diff_new_pack.VCVUNU/_new 2026-07-08 17:42:45.162465225 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pook # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,32 +19,37 @@ # requires python-aiohttp %{?sle15_python_module_pythons} Name: python-pook -Version: 1.1.1 +Version: 2.1.6 Release: 0 Summary: HTTP traffic mocking and expectations License: MIT URL: https://github.com/h2non/pook -Source: https://files.pythonhosted.org/packages/source/p/pook/pook-%{version}.tar.gz +Source: https://github.com/h2non/pook/archive/refs/tags/v%{version}.tar.gz#/pook-%{version}.tar.gz +# PATCH-FIX-UPSTREAM fix_tests.patch bugno [email protected] +# substitute missing get_original method in unittest.mock +Patch0: fix_tests.patch +BuildRequires: %{python_module hatchling} BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-aiohttp Requires: python-furl >= 0.5.6 Requires: python-jsonschema >= 2.5.1 Requires: python-xmltodict >= 0.11.0 BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module aiohttp} +BuildRequires: %{python_module aiohttp >= 3.10} +BuildRequires: %{python_module async-timeout >= 4.0} +BuildRequires: %{python_module falcon >= 4.0} BuildRequires: %{python_module furl >= 0.5.6} +BuildRequires: %{python_module httpx >= 0.26} BuildRequires: %{python_module jsonschema >= 2.5.1} -BuildRequires: %{python_module mocket >= 1.6.0} -BuildRequires: %{python_module pytest-asyncio} -BuildRequires: %{python_module pytest} +BuildRequires: %{python_module mocket >= 3.12.2} +BuildRequires: %{python_module pytest >= 8.3} +BuildRequires: %{python_module pytest-asyncio >= 1.3.0} +BuildRequires: %{python_module pytest-pook >= 0.1.0b0} BuildRequires: %{python_module requests >= 2.20.0} -BuildRequires: %{python_module urllib3 >= 1.19.1} -BuildRequires: %{python_module xmltodict >= 0.10.2} +BuildRequires: %{python_module urllib3 >= 2.2} +BuildRequires: %{python_module xmltodict >= 0.11.0} # /SECTION %python_subpackages @@ -63,9 +68,7 @@ %install %pyproject_install -%{python_expand rm -r %{buildroot}%{$python_sitelib}/tests/ -%fdupes %{buildroot}%{$python_sitelib} -} +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check %{python_expand # ++++++ fix_tests.patch ++++++ --- src/pook/interceptors/_httpx.py | 16 ++++++++++++---- src/pook/interceptors/aiohttp.py | 8 ++++++-- src/pook/interceptors/base.py | 24 ++++++++++++++++++++++++ src/pook/interceptors/http.py | 11 +++++------ src/pook/interceptors/urllib3.py | 9 ++++----- 5 files changed, 51 insertions(+), 17 deletions(-) Index: pook-2.1.6/src/pook/interceptors/_httpx.py =================================================================== --- pook-2.1.6.orig/src/pook/interceptors/_httpx.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/interceptors/_httpx.py 2026-07-08 16:02:54.165220333 +0200 @@ -35,12 +35,14 @@ else: transport_cls = SyncTransport - def handler(client, *_): - return transport_cls(self, client, _original_transport_for_url) - try: + # Resolve the original function before patching + original_func = self.resolve_path(path) + + def handler(client, *_): + return transport_cls(self, client, original_func) + patcher = mock.patch(path, handler) - _original_transport_for_url = patcher.get_original()[0] # type: ignore[var-annotated] patcher.start() except Exception: pass Index: pook-2.1.6/src/pook/interceptors/aiohttp.py =================================================================== --- pook-2.1.6.orig/src/pook/interceptors/aiohttp.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/interceptors/aiohttp.py 2026-07-08 16:02:20.178247069 +0200 @@ -84,10 +84,14 @@ return super_request(session, *args, **kwargs) try: + # Resolve the original function before patching + path = "aiohttp.client.ClientSession._request" + original_request = self.resolve_path(path) + # Patch ClientSession init to append this interceptor as an aiohttp # middleware to all session's middlewares - patcher = mock.patch("aiohttp.client.ClientSession._request", _request) - super_request = patcher.get_original()[0] + patcher = mock.patch(path, _request) + super_request = original_request # Start patching function calls patcher.start() except Exception: @@ -116,6 +120,11 @@ def HTTPResponse(session: aiohttp.ClientSession, *args, **kw): + import inspect + sig = inspect.signature(session._response_class.__init__) + if "stream_writer" in sig.parameters: + kw.setdefault("stream_writer", mock.Mock()) + return session._response_class( *args, request_info=mock.Mock(), Index: pook-2.1.6/src/pook/interceptors/base.py =================================================================== --- pook-2.1.6.orig/src/pook/interceptors/base.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/interceptors/base.py 2026-07-08 16:02:20.178435804 +0200 @@ -1,4 +1,5 @@ from abc import ABCMeta, abstractmethod +import importlib class BaseInterceptor: @@ -9,6 +10,29 @@ __metaclass__ = ABCMeta + def resolve_path(self, path: str): + """ + Resolves a dot-separated path to the actual object. + Example: 'httpx.Client._transport_for_url' -> the function object. + """ + parts = path.split('.') + for i in range(len(parts) - 1, 0, -1): + module_path = '.'.join(parts[:i]) + try: + module = importlib.import_module(module_path) + obj = module + for part in parts[i:]: + obj = getattr(obj, part) + return obj + except (ImportError, AttributeError): + continue + + # Fallback for single-part paths + try: + return importlib.import_module(path) + except ImportError: + raise ImportError(f"Could not resolve path: {path}") + def __init__(self, engine): self.patchers = [] self.engine = engine Index: pook-2.1.6/src/pook/interceptors/http.py =================================================================== --- pook-2.1.6.orig/src/pook/interceptors/http.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/interceptors/http.py 2026-07-08 16:03:04.000399310 +0200 @@ -98,28 +98,27 @@ return mockres def _patch(self, path): - def handler(conn, method, url, body=None, headers=None, **kw): - # Detect if httplib was called by urllib3 interceptor - # This is a bit ugly, I know. Ideas are welcome! - if headers and URLLIB3_BYPASS in headers: - # Remove bypass header used as flag - headers.pop(URLLIB3_BYPASS) - # Call original patched function - return request(conn, method, url, body=body, headers=headers, **kw) + try: + # Resolve the original function before patching + original_func = self.resolve_path(path) - # Otherwise call the request interceptor - return self._on_request( - request, conn, method, url, body=body, headers=headers, **kw - ) + def handler(conn, method, url, body=None, headers=None, **kw): + # Detect if httplib was called by urllib3 interceptor + # This is a bit ugly, I know. Ideas are welcome! + if headers and URLLIB3_BYPASS in headers: + # Remove bypass header used as flag + headers.pop(URLLIB3_BYPASS) + # Call original patched function + return original_func(conn, method, url, body=body, headers=headers, **kw) + + # Otherwise call the request interceptor + return self._on_request( + original_func, conn, method, url, body=body, headers=headers, **kw + ) - try: # Create a new patcher for Urllib3 urlopen function # used as entry point for all the HTTP communications patcher = mock.patch(path, handler) - # Retrieve original patched function that we might need for real - # networking - request = patcher.get_original()[0] - # Start patching function calls patcher.start() except Exception: # Exceptions may accur due to missing package Index: pook-2.1.6/src/pook/interceptors/urllib3.py =================================================================== --- pook-2.1.6.orig/src/pook/interceptors/urllib3.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/interceptors/urllib3.py 2026-07-08 16:03:21.321714517 +0200 @@ -166,24 +166,23 @@ ) def _patch(self, path): - def handler(conn, method, url, body=None, headers=None, **kw): - # Flag that the current request as urllib3 intercepted - headers = headers or {} - headers[URLLIB3_BYPASS] = "1" + try: + # Resolve the original function before patching + original_func = self.resolve_path(path) - # Call request interceptor - return self._on_request( - urlopen, path, conn, method, url, body=body, headers=headers, **kw - ) + def handler(conn, method, url, body=None, headers=None, **kw): + # Flag that the current request as urllib3 intercepted + headers = headers or {} + headers[URLLIB3_BYPASS] = "1" + + # Call request interceptor + return self._on_request( + original_func, path, conn, method, url, body=body, headers=headers, **kw + ) - try: # Create a new patcher for Urllib3 urlopen function # used as entry point for all the HTTP communications patcher = mock.patch(path, handler) - # Retrieve original patched function that we might need for real - # networking - urlopen = patcher.get_original()[0] - # Start patching function calls patcher.start() except Exception: # Exceptions may accur due to missing package Index: pook-2.1.6/src/pook/matchers/headers.py =================================================================== --- pook-2.1.6.orig/src/pook/matchers/headers.py 2026-07-08 15:54:29.078008908 +0200 +++ pook-2.1.6/src/pook/matchers/headers.py 2026-07-08 16:02:20.179042938 +0200 @@ -16,19 +16,16 @@ @BaseMatcher.matcher def match(self, req): for key in self.expectation: - assert key in req.headers, f"Header '{key}' not present" + if key not in req.headers: + raise AssertionError(f"Header '{key}' not present") expected_value = self.to_comparable_value(self.expectation[key]) # Retrieve header value by key actual_value = req.headers.get(key) - assert not all( - [ - expected_value is not None, - actual_value is None, - ] - ), f"Expected a value `{expected_value}` " f"for '{key}' but found `None`" + if expected_value is not None and actual_value is None: + raise AssertionError(f"Expected a value `{expected_value}` for '{key}' but found `None`") # Compare header value if not self.compare(expected_value, actual_value, regex_expr=True): ++++++ pook-1.1.1.tar.gz -> pook-2.1.6.tar.gz ++++++ ++++ 14557 lines of diff (skipped)
