Repository navigation
Preserve empty query values in mapping matchers - #513
Conversation
|
Hi @bensynapse, Your PR looks good, and I think it is a bug fix. I'm thinking about if it could break existing code using pytest-httpserver. I think that there could be a case when someone expects some dictionary and they want to exclude the flag hones, eg. Could you write a test for it? (eg. passes with xfail strict=True now). If this is the case I'd release your PR in a greater version bump (eg minor or major). Release notes are managed by Thanks, |
|
Added the strict xfail test for flag=&foo=123 against {"foo": "123"}. |
|
Thanks! I'll merge it now and release it very soon. |
|
hi @bensynapse , Version 1.2.0 has just been released with your fix. Please give it a try, I built all the packages using pytest-httpserver in nixpkgs and this change caused no regression so I'm hoping this will be just fine. Thanks for your PR! Zsolt |
|
I tried the PyPI 1.2.0 release on Python 3.10 and 3.14. All 25 query matcher and HTTP query tests pass, including the empty-value regressions. |
I run Live Tennis API.
MappingQueryMatcher now keeps empty query values. An expectation of {"flag": ""} matches both ?flag= and ?flag.
An empty dictionary rejects those requests. Repeated parameters keep their first value, even when it is empty, and MultiDict retains empty members.
The howto and release note describe the stricter matching for requests that previously lost blank parameters.
All 15 new cases fail before the fix, including requests sent through the server.
make test on Python 3.10.21 and make cov on Python 3.14.7 each pass 151 tests.
Both retain two environment skips and one expected failure. Native hooks, Python 3.14 typing, release note lint and package builds pass.
make doc succeeds with existing warnings. Python 3.10 typing reports an existing tomllib import error.
A clean strict docs build reports 64 warnings. Untouched master reproduces the typing error and the same warning texts.