- Ensure aiohttp headers can be matched from both the session and request in the same matcher
- 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.
- 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.
- Drop support for Python 3.8 (it is EOL 2024-10-07)
- Improve aiohttp JSONMatcher support by @KyleJamesWalker in #139
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.- 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).- 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).
- 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.
- Fix httpx incorrectly named method on interceptor subclass by @sarayourfriend in #126
- fix #122: httpx streaming via iter_raw raises httpx.StreamConsumed by @petarmaric in #123
- Fix Mock constructor params/url order mishandling (#111)
- Optionally match empty values in query parameter presence matcher (#113)
- Fix httpx network mode (#116)
- Add support for httpx (#90)
- Enable mocket integration tests for Python >= 3.11 (#103)
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
- Fix usage of regex values in header matchers (#97)
- Fix urllib SSL handling (#98)
- feat(api): add support for binary bodies (#88)
- fix(urllib3): don't put non-strings into HTTP header dict (#87)
- refactor: drop Python 3.5 support (#92). Note: Python 3.5 had been supported for some time. The change here only makes the documentation accurately reflect that 3.5 is not supported.
- chore(version): bump minor v1.1.0
- Switch to Python >= 3.5 and fix latest aiohttp compatability (#83)
- fix: remove print call (#81)
- fix(urllib3): interceptor is never really disabled (#68)
- Closes #75 Re consider @fluent decorator (#76)
- fix(#69): use match keyword in pytest.raises
- fix(History): invalid rst syntax
- fix(aiohttp): compatible with non aiohttp projects (#67)
- feat(History): add release changes
- fix(aiohttp): use latest version, allow Python 3.5+ for async http client
- fix collections import warning (#61)
- fix collections import warning (#61)
- Add mock.reply(new_response=True) to reset response definition object
- refactor(setup): remove extra install dependency
- Fix py27 compatibility (#49)
- Add activate_async decorator (#48)
- fix typo in pook.mock.Mock.ismatched.__doc__ (#47)
- fix README example (#46)
- fix(#45): regex URL issue
- fix(travis): allow failures in pypy
- feat(docs): add sponsor banner
- refactor(History): normalize style
- feat(docs): add supported version for aiohttp
- Merge branch 'master' of https://github.com/h2non/pook
- fix(api): export missing symbol "disable_network"
- Update README.rst (#43)
- refactor(compare): disable maxDiff length limit while comparing values
- fix(engine): enable new mock engine on register if needed
- fix(engine): remove activate argument before instantiating the Mock
- refactor(engine): do not activate engine on mock declaration if not explicitly requested. This introduces a behavioral library change: you must explicitly use
pook.on()
to enable pook mock engine.
- feat(docs): list supported HTTP client versions
- fix(#41): disable mocks after decorator call invokation
- feat(examples): add mock context manager example file
- feat(#40): support context manager definitions
- feat(#39): improve unmatched request output
- feat(docs): add mocket example file
- feat(#33): add mocket examples and documentation
- fix(api): mock.calls property should be an int.
- feat(#33): proxy mock definitions into mock.Request
- refactor(api): pook.unmatched_requests() now returns a list instead of a lazy tuple.
- refactor(query)
- fix(#37): fix URL comparison
- fix(#38): proper mock engine interface validation.
- fix(#37): decode byte bodies
- feat(setup.py): add author email
- fix(Makefile): remove proper egg file
- feat(package): add wheel package distribution support
- feat(docs): add documentation links
- fix(assertion): extract regex pattern only when required
- feat(examples): add regular expression example
- feat(#33): add support for user defined custom mock engine
- fix(setup.py): force utf-8 encoding
- feat(setup.py): add encoding header
- feat(api): add debug mode
- refactor(docs): minor enhancements
- refactor(tests): update URL matcher test cases
- refactor(docs): add note about HTTP clients and update features list
- fix(setup.py): remove encoding param
- fix(tests): use strict equality assertion
- fix(matchers): fix matching issue in URL.
- refactor(assertion): regex expression based matching must be explicitly enabled.
- feat(tests): add initial matchers tests.
- refactor(README): minor changes
- fix(setup.py): lint error
- fix(#32): use explicit encoding while reading files in setup.py
- fix(core): several bug fixes.
- feat(core): add pending features and major refactors.
- feat(matchers): use
unittest.TestCase
matching engine by default.
- fix(matchers): runtime missing variable.
- fix: Python 2 dictionary iteration syntax.
- feat(docs): add more examples.
- fix(matchers): better regular expression comparison support.
- First version (still beta)
- First release candidate version (still beta)