Skip to content

Commit dbc20d7

Browse files
authored
Release version 0.36.0 today
2 parents 308b8dc + e02259c commit dbc20d7

File tree

7 files changed

+59
-19
lines changed

7 files changed

+59
-19
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 25.1.0
3+
rev: 25.11.0
44
hooks:
55
- id: black

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
## [0.36.0] - 2025-12-02
10+
### Changed
11+
- `pytest` required version is now `9`.
12+
813
### Added
14+
- Explicit support for python `3.14`.
915
- `match_params` parameter is now available on responses and callbacks registration, as well as request(s) retrieval. Allowing to provide query parameters as a dict instead of being part of the matched URL.
1016
- This parameter allows to perform partial query params matching ([refer to documentation](README.md#matching-on-query-parameters) for more information).
1117

1218
### Fixed
1319
- URL with more than one value for the same parameter were not matched properly (matching was performed on the first value).
1420
- `httpx_mock.add_exception` is now properly documented (accepts `BaseException` instead of `Exception`).
1521

22+
### Removed
23+
- `pytest` `8` is not supported anymore.
24+
- python `3.9` is not supported anymore.
25+
1626
## [0.35.0] - 2024-11-28
1727
### Changed
1828
- Requires [`httpx`](https://www.python-httpx.org)==0.28.\*
@@ -415,7 +425,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
415425
### Added
416426
- First release, should be considered as unstable for now as design might change.
417427

418-
[Unreleased]: https://github.com/Colin-b/pytest_httpx/compare/v0.35.0...HEAD
428+
[Unreleased]: https://github.com/Colin-b/pytest_httpx/compare/v0.36.0...HEAD
429+
[0.36.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.35.0...v0.36.0
419430
[0.35.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.34.0...v0.35.0
420431
[0.34.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.33.0...v0.34.0
421432
[0.33.0]: https://github.com/Colin-b/pytest_httpx/compare/v0.32.0...v0.33.0

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ issues = "https://github.com/Colin-b/pytest_httpx/issues"
5151
[project.optional-dependencies]
5252
testing = [
5353
# Used to check coverage
54-
"pytest-cov==6.*",
54+
"pytest-cov==7.*",
5555
# Used to run async tests
5656
"pytest-asyncio==1.*",
5757
]
@@ -65,3 +65,6 @@ version = {attr = "pytest_httpx.version.__version__"}
6565
[tool.pytest]
6666
# Silence deprecation warnings about option "asyncio_default_fixture_loop_scope"
6767
asyncio_default_fixture_loop_scope = "function"
68+
69+
[tool.coverage.run]
70+
patch = ["subprocess"]

pytest_httpx/_request_matcher.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ def __init__(
9090
"Otherwise, use match_content."
9191
)
9292
if self.params and not self.url:
93-
raise ValueError(
94-
"URL must be provided when match_params is used."
95-
)
93+
raise ValueError("URL must be provided when match_params is used.")
9694
if self.params and isinstance(self.url, re.Pattern):
9795
raise ValueError(
9896
"match_params cannot be used in addition to regex URL. Request this feature via https://github.com/Colin-b/pytest_httpx/issues/new?title=Regex%20URL%20should%20allow%20match_params&body=Hi,%20I%20need%20a%20regex%20to%20match%20the%20non%20query%20part%20of%20the%20URL%20only"
@@ -124,7 +122,11 @@ def _is_matching_body_more_than_one_way(self) -> bool:
124122
return sum(matching_ways) > 1
125123

126124
def _is_matching_params_more_than_one_way(self) -> bool:
127-
url_has_params = bool(self.url.params) if (self.url and isinstance(self.url, httpx.URL)) else False
125+
url_has_params = (
126+
bool(self.url.params)
127+
if (self.url and isinstance(self.url, httpx.URL))
128+
else False
129+
)
128130
matching_ways = [
129131
self.params is not None,
130132
url_has_params,

pytest_httpx/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0)
44
# Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0)
55
# Patch should be incremented in case there is a bug fix. (eg: 2.5.8 -> 2.5.9)
6-
__version__ = "0.35.0"
6+
__version__ = "0.36.0"

tests/test_httpx_async.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ async def test_url_query_params_not_matching(httpx_mock: HTTPXMock) -> None:
185185

186186

187187
@pytest.mark.asyncio
188-
async def test_url_matching_with_more_than_one_value_on_same_param(httpx_mock: HTTPXMock) -> None:
188+
async def test_url_matching_with_more_than_one_value_on_same_param(
189+
httpx_mock: HTTPXMock,
190+
) -> None:
189191
httpx_mock.add_response(url="https://test_url?a=1&a=3", is_optional=True)
190192

191193
async with httpx.AsyncClient() as client:
@@ -195,7 +197,9 @@ async def test_url_matching_with_more_than_one_value_on_same_param(httpx_mock: H
195197

196198
@pytest.mark.asyncio
197199
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
198-
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_value(httpx_mock: HTTPXMock) -> None:
200+
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_value(
201+
httpx_mock: HTTPXMock,
202+
) -> None:
199203
httpx_mock.add_response(url="https://test_url?a=2&a=3", is_optional=True)
200204

201205
async with httpx.AsyncClient() as client:
@@ -210,7 +214,9 @@ async def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_
210214

211215
@pytest.mark.asyncio
212216
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
213-
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_values(httpx_mock: HTTPXMock) -> None:
217+
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_values(
218+
httpx_mock: HTTPXMock,
219+
) -> None:
214220
httpx_mock.add_response(url="https://test_url?a=1&a=3", is_optional=True)
215221

216222
async with httpx.AsyncClient() as client:
@@ -225,7 +231,9 @@ async def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_
225231

226232
@pytest.mark.asyncio
227233
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
228-
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_less_values(httpx_mock: HTTPXMock) -> None:
234+
async def test_url_not_matching_with_more_than_one_value_on_same_param_and_less_values(
235+
httpx_mock: HTTPXMock,
236+
) -> None:
229237
httpx_mock.add_response(url="https://test_url?a=1&a=3&a=4", is_optional=True)
230238

231239
async with httpx.AsyncClient() as client:

tests/test_httpx_sync.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,29 @@ def test_match_params_without_url(httpx_mock: HTTPXMock) -> None:
156156
with pytest.raises(ValueError) as exception_info:
157157
httpx_mock.add_response(match_params={"a": "1"})
158158

159-
assert str(exception_info.value) == "URL must be provided when match_params is used."
159+
assert (
160+
str(exception_info.value) == "URL must be provided when match_params is used."
161+
)
160162

161163

162164
def test_query_params_in_both_url_and_match_params(httpx_mock: HTTPXMock) -> None:
163165
with pytest.raises(ValueError) as exception_info:
164166
httpx_mock.add_response(url="https://test_url?a=1", match_params={"a": "1"})
165167

166-
assert str(exception_info.value) == "Provided URL must not contain any query parameter when match_params is used."
168+
assert (
169+
str(exception_info.value)
170+
== "Provided URL must not contain any query parameter when match_params is used."
171+
)
167172

168173

169174
def test_regex_url_and_match_params(httpx_mock: HTTPXMock) -> None:
170175
with pytest.raises(ValueError) as exception_info:
171176
httpx_mock.add_response(url=re.compile(".*test.*"), match_params={"a": "1"})
172177

173-
assert str(exception_info.value) == "match_params cannot be used in addition to regex URL. Request this feature via https://github.com/Colin-b/pytest_httpx/issues/new?title=Regex%20URL%20should%20allow%20match_params&body=Hi,%20I%20need%20a%20regex%20to%20match%20the%20non%20query%20part%20of%20the%20URL%20only"
178+
assert (
179+
str(exception_info.value)
180+
== "match_params cannot be used in addition to regex URL. Request this feature via https://github.com/Colin-b/pytest_httpx/issues/new?title=Regex%20URL%20should%20allow%20match_params&body=Hi,%20I%20need%20a%20regex%20to%20match%20the%20non%20query%20part%20of%20the%20URL%20only"
181+
)
174182

175183

176184
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
@@ -191,7 +199,9 @@ def test_url_query_params_not_matching(httpx_mock: HTTPXMock) -> None:
191199
)
192200

193201

194-
def test_url_matching_with_more_than_one_value_on_same_param(httpx_mock: HTTPXMock) -> None:
202+
def test_url_matching_with_more_than_one_value_on_same_param(
203+
httpx_mock: HTTPXMock,
204+
) -> None:
195205
httpx_mock.add_response(url="https://test_url?a=1&a=3", is_optional=True)
196206

197207
with httpx.Client() as client:
@@ -200,7 +210,9 @@ def test_url_matching_with_more_than_one_value_on_same_param(httpx_mock: HTTPXMo
200210

201211

202212
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
203-
def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_value(httpx_mock: HTTPXMock) -> None:
213+
def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_value(
214+
httpx_mock: HTTPXMock,
215+
) -> None:
204216
httpx_mock.add_response(url="https://test_url?a=2&a=3", is_optional=True)
205217

206218
with httpx.Client() as client:
@@ -214,7 +226,9 @@ def test_url_not_matching_with_more_than_one_value_on_same_param_and_diff_value(
214226

215227

216228
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
217-
def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_values(httpx_mock: HTTPXMock) -> None:
229+
def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_values(
230+
httpx_mock: HTTPXMock,
231+
) -> None:
218232
httpx_mock.add_response(url="https://test_url?a=1&a=3", is_optional=True)
219233

220234
with httpx.Client() as client:
@@ -228,7 +242,9 @@ def test_url_not_matching_with_more_than_one_value_on_same_param_and_more_values
228242

229243

230244
@pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
231-
def test_url_not_matching_with_more_than_one_value_on_same_param_and_less_values(httpx_mock: HTTPXMock) -> None:
245+
def test_url_not_matching_with_more_than_one_value_on_same_param_and_less_values(
246+
httpx_mock: HTTPXMock,
247+
) -> None:
232248
httpx_mock.add_response(url="https://test_url?a=1&a=3&a=4", is_optional=True)
233249

234250
with httpx.Client() as client:

0 commit comments

Comments
 (0)