Migrate conftest.py MockResponse fixture chains to MockHTTPResponse#23226
Migrate conftest.py MockResponse fixture chains to MockHTTPResponse#23226mwdd146980 wants to merge 4 commits intomwdd146980/step3d-batch-migrate-mockresponsefrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report❌ Patch coverage is Additional details and impacted files🚀 New features to boost your workflow:
|
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".
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>
96bc51f to
e79d221
Compare
000eac1 to
5b6df5a
Compare
This comment has been minimized.
This comment has been minimized.
These conftest.py files now import from datadog_checks.base.utils.http_testing which was added in PR #22676. The minimum-base-package CI test installs the oldest pinned base version from PyPI, which doesn't have this module. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Motivation
Part of the requests→httpx test decoupling. 13
conftest.pyfiles still importMockResponseand 11 patchrequests.Session.*— both break when the HTTP backend switches to httpx.Approach
Swap
MockResponse→MockHTTPResponsein all 13 files. For 10 integrations, also replacerequests.Session.*patches with themock_httpfixture (mock_http.get.side_effect = routing_fn). Two partial migrations:requests.Sessionin the chain (details)mocked_bad_cert_request: kept Session patch — testsverify=TruevsFalsewhich requiresRequestsWrapperin the chain (details)Also widens
citrix_hypervisorJSONDecodeErrorexcept clause (same pattern as steps 3c/3d) and bumps minimumdatadog-checks-baseto>=37.35.0for all 13 integrations since their conftest.py now imports fromhttp_testing(added in PR #22676).Verification
All 13 integration test suites pass (
ddev --no-interactive test --recreate).🤖 Generated with Claude Code