Migrate conftest.py MockResponse fixture chains to MockHTTPResponse#23226
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ce699e0 to
573c1ba
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96bc51f8db
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
96bc51f to
e79d221
Compare
000eac1 to
5b6df5a
Compare
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: c22010a | Docs | Datadog PR Page | Give us feedback! |
0caefaa to
4c1a5da
Compare
4c1a5da to
2369a51
Compare
5b6df5a to
406407a
Compare
406407a to
d40acc2
Compare
2369a51 to
14387fd
Compare
d40acc2 to
9971aa6
Compare
14387fd to
33ed764
Compare
33ed764 to
e310970
Compare
9971aa6 to
aeea062
Compare
triviajon
left a comment
There was a problem hiding this comment.
lgtm for container-integrations owned files
Migrate 31 test files from `MockResponse` (requests-coupled) to `MockHTTPResponse` (library-agnostic) as part of the requests→httpx decoupling. Also widen JSONDecodeError except clauses in spark and proxmox production code, add `links` property to MockHTTPResponse for pagination support, and update test assertions that referenced requests-specific exception class names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix links property to split on ", <" instead of bare commas, matching requests.Response.links behavior (avoids breaking URLs containing commas) - Update elastic test assertions to remove requests-specific ": None for url: None" error suffix - Widen elastic _get_template_metrics except clause to catch AgentHTTPError alongside requests.RequestException Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix links property to fall back to keying by URL when rel is absent (matching requests.Response.links behavior) - Add 6 dedicated unit tests for the links property: standard rel, multiple links, empty header, no-rel fallback, commas in URLs, and header pop clearing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop 5 tests that tested Python internals or trivial one-liners rather than MockHTTPResponse behavior: ok property (status < 400), reason property (stdlib dict lookup), headers delete/pop (dict ops), headers update with custom Mapping (unused code path), url attribute (attribute assignment). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace MockResponse with MockHTTPResponse in 13 conftest.py files. For 10 integrations, also migrate requests.Session.* patches to use the mock_http fixture with configured side_effect, making tests backend-agnostic. openstack_controller keeps Session patches due to keystoneauth1 SDK coupling. Widen citrix_hypervisor JSONDecodeError except clause for stdlib compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e310970 to
c22010a
Compare
aeea062 to
e1c120e
Compare
Validation ReportAll 20 validations passed. Show details
|
d181f9a
into
mwdd146980/httpx-migration-base

Motivation
Part of the requests→httpx test decoupling. The remaining
conftest.pyfiles that importMockResponseand patchrequests.Session.*break when the HTTP backend switches to httpx.Approach
Swap
MockResponse→MockHTTPResponseand replacerequests.Session.*patches with themock_httpfixture, which intercepts at theAgentCheck.httpproperty level and works regardless of HTTP backend. openstack_controller and yarn were partially migrated. Session patches kept for now (details).Also dropped auth kwargs validation from hdfs_datanode/hdfs_namenode/mapreduce/yarn fixtures — these tested HTTP wrapper plumbing, not integration behavior. Consistent with Step 2's migration to config assertions.
No production code changes — all production except clause widenings are in PR #23046.
Details: Step 3e on Confluence
Verification
All affected integration test suites pass (
ddev --no-interactive test --recreate).🤖 Generated with Claude Code