Releases: h2non/pook
v2.1.2
Available on PyPI: https://pypi.org/project/pook/2.1.2/
What's Changed
- Return the correct type of
headers
object for standard library urllib by @sarayourfriend in #154. - Support
Sequence[tuple[str, str]]
header input with aiohttp by @sarayourfriend in #154. - Fix network filters when multiple filters are active by @rsmeral in #155.
- Fix aiohttp matching not working with session base URL or headers by @sarayourfriend in #157.
- Add support for Python 3.13 by @sarayourfriend in #149.
New Contributors
Full Changelog: v2.1.1...v2.1.2
v2.1.1
What's Changed
- Flush mocks when
pook.activate
used as a wrapper by @shift0965 in #145- This prevents mocks from leaking between test cases and should fix some potentially confusing edge case bugs.
New Contributors
- @shift0965 made their first contribution in #145
Full Changelog: v2.1.0...v2.1.1
v2.1.0
Available on PyPI: https://pypi.org/project/pook/2.1.0/
- Drop support for Python 3.8 by @sarayourfriend in #141
Full Changelog: v2.0.1...v2.1.0
v2.0.1
https://pypi.org/project/pook/2.0.1/
- Improve aiohttp JSONMatcher support by @KyleJamesWalker in #139
Full Changelog: v2.0.0...v2.0.1
v2.0.0
Available on PyPI: https://pypi.org/project/pook/2.0.0/
See #128 for a summary of the breaking changes and how to update your code if you are affected.
-
Breaking change: Remove
Response::body
'sbinary
parameter and enforce a keyword argument forchunked
.- 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 removedbinary
parameter cannot be confused aschunked
arguments.
- The
-
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 mockurllib
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).
- This is possible because for all supported client libraries, pook mocks the actual response sent to the
-
Breaking change: Remove
Mock::body
'sbinary
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).
- This parameter was already unused due to a bug in the code (it was not passed through to the
-
Correct documentation strings for
XMLMatcher
andJSONMatcher
to no longer suggest they can handle regex matchers.- These classes never implemented regex matching.
-
Add a pytest fixture to the package (kudos @wimglenn)
v1.4.3
What's Changed
- Fix httpx incorrectly named method on interceptor subclass by @sarayourfriend in #126
Full Changelog: v1.4.2...v1.4.3
v1.4.2
What's Changed
- fix #122: httpx streaming via
iter_raw
raiseshttpx.StreamConsumed
by @petarmaric in #123
New Contributors
- @petarmaric made their first contribution in #123
Full Changelog: v1.4.1...v1.4.2
v1.4.1
What's Changed
- Fix
Mock
constructor params/url order mishandling by @sarayourfriend in #111 - Optionally match empty values in query parameter presence matcher by @sarayourfriend in #113
- Fix #115, httpx network mode by @sarayourfriend in #116
- Kudos @plyq for the report
Full Changelog: v1.4.0...v1.4.1
v1.4.0
What's Changed
- Enable mocket tests for >3.10 by @sarayourfriend in #103
- Add HTTPX support by @sarayourfriend in #91
- Thank you @tekumara for helping test the httpx feature
- Set requires-python to fix build metadata by @sarayourfriend in #106
- Fix httpx reference in README and add build and dist check to CI workflow by @sarayourfriend in #107
Full Changelog: v1.3.0...v1.4.0
v1.3.0
This release modernizes Pook build and development environments.
- 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