Repository navigation
Conversation
Pavel-Shcherbo
left a comment
There was a problem hiding this comment.
Reviewed commit 0d0984e on CPython 3.14.6 with HTTPX 0.28.1.
tests/test_utils.py --no-cov: 5 passed. I also checked the cookie jar through respx.mock / respond(cookies=...) / httpx.Client: UTC offsets -12:00, -05:00, -03:30, +00:00, +05:30 and +14:00, plus both Toronto DST folds on 2030-11-03. All eight retain int(expires.timestamp()) at this head; seven fail against the base implementation. Three further controls preserve naive datetime, naive-like tzinfo (utcoffset() is None) and string behavior.
The utcoffset() guard handles awareness correctly without converting naive-like values through the machine's local timezone. I found no blocking issue in this diff.
One optional follow-up: retain a public-API cookie-jar assertion in the project suite, alongside the formatting test. That would directly cover the expiration behavior users observe. This review covers the cookie change and focused controls; I have not run the full RESPX compatibility matrix.
|
Thanks for the detailed review. Added a focused public-API regression in It fails against the original implementation (a 5h30m shift) and passes with the fix. The documented Python 3.11 nox session now has 326 passing tests, 2 remote pass-through skips and 100% configured statement/branch coverage; pinned hooks and mypy pass. I have not run the full compatibility matrix. |
|
Independently checked This follow-up is limited to those synchronous checks; I have not independently verified the full compatibility matrix or coverage result. |
SetCookie(expires=...)formats non-UTC datetimes with their local wall-clock fields followed byGMT, shifting the expiration instant. A future cookie can consequently appear expired to HTTPX.Convert aware datetimes to UTC before formatting. The focused parameterized regression covers both offset directions (including a half-hour offset), a year boundary, and the existing naive-datetime/string behavior; the existing all-attributes test covers UTC.
Fixes #336.
Review follow-up: adds one public
respx.mock/respond(cookies=...)/httpx.Clientregression asserting the stored cookie-jar expiration matches the aware datetime's epoch. It fails against the original implementation and passes with this fix.Validation on macOS:
nox -s test-3.11: 326 passed, 2 remote pass-through tests skipped, 100% configured statement/branch coverage (Python 3.11.15).respx.mock/respond(cookies=...)/ HTTPX 0.28.1 client checks confirm identical cookie-jar expiry timestamps for UTC and both offset directions. Additional local controls cover Toronto DST folds and a naive-liketzinfo.AI assistance was used for code inspection, implementation, and local test execution. The issue was found through code analysis and reproduction, not a production incident.