Skip to content

Conversation

@Mohataseem89
Copy link

refactor mock response handling and improve error behavior.

chnages/improvements:

  1. made raise_for_status to behave correctly:
    -it prevents silent failures, critical for API-dependent tests
  2. added enter / exit to MockResponse:
    -it will make the mock compatible with code using with requests.get(...)
  3. made mock_response fixture safer:
    -it ensures missing/invalid parameters fail loudly rather than silently passing
  4. added some comments to improve structure/readability
  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

refactor mock response handling and improve error behavior.
@mroeschke
Copy link
Member

Thanks for the PR, but I think the current layout is OK for now. If you disagree, please open an issue first to discuss why these changes are needed

@mroeschke mroeschke closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants