Commit 6a26429
committed
fix(testing): correct async mocker for httpx 0.28 body matching
Address PR review on the httpx 0.28 / pytest-httpx 0.35 bump.
- match_content now mirrors httpx 0.28's request-body serialization
exactly by adding ensure_ascii=False and allow_nan=False. Without
them a non-ASCII match_body serialized to \uXXXX escapes while httpx
sends raw UTF-8, so the mock silently failed to match.
- Pin an upper bound pytest-httpx >=0.35,<1. It is a runtime dependency
(connect.client.testing ships the mocker and a pytest11 plugin) that
relies on private pytest_httpx API (_HTTPXMockOptions, _assert_options),
so an unbounded minor bump could break downstream test suites.
- Add test_create_match_non_ascii_body and test_unrequested_mock_fails
to cover the non-ASCII matching and the reset() assertion path, which
previously had no coverage.1 parent c14e8ee commit 6a26429
4 files changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| 244 | + | |
| 245 | + | |
243 | 246 | | |
244 | 247 | | |
245 | 248 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
| |||
0 commit comments