Skip to content

Add response_delay_seconds parameter for testing timeouts#2885

Merged
adamtheturtle merged 9 commits intomainfrom
adamtheturtle/response-delay
Feb 15, 2026
Merged

Add response_delay_seconds parameter for testing timeouts#2885
adamtheturtle merged 9 commits intomainfrom
adamtheturtle/response-delay

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 2, 2026

Summary

Adds response_delay_seconds parameter to MockVWS to simulate slow HTTP responses, enabling testing of request timeout handling. When the delay exceeds a client's timeout, requests.exceptions.Timeout is raised naturally.

Test plan

  • 5 new tests covering timeout behavior with raw requests and VWS client
  • All existing tests continue to pass

Note

Low Risk
Adds an opt-in delay wrapper around mock callbacks plus new tests; no production networking or security logic is changed.

Overview
MockVWS now accepts a response_delay_seconds parameter that delays every mocked VWS/VWQ response, and simulates client-side timeouts by inspecting the request’s timeout (including (connect, read) tuples) and raising requests.exceptions.Timeout when the delay exceeds the effective read timeout.

Adds focused tests validating the default no-delay behavior and timeout/non-timeout outcomes, and documents the new parameter in CHANGELOG.rst.

Written by Cursor Bugbot for commit 216fc9f. This will update automatically on new commits. Configure here.

This adds support for simulating slow HTTP responses in MockVWS to enable
testing of request timeout handling. When response_delay_seconds is set
higher than a client's timeout, requests.exceptions.Timeout is raised.
The delay is applied at the HTTP response level so requests' native timeout
handling triggers naturally.

Also includes 5 new tests covering timeout behavior with both raw requests
and VWS client integration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Remove the [tool.uv.sources] section that pointed to a local
vws-python path which doesn't exist on CI runners.

Replace tests that depended on unreleased vws-python features
(request_timeout_seconds) with a test that uses tuple timeouts
directly with the requests library.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…atic method

Consolidate the duplicate VWS/VWQ route registration loops into a single
loop and extract wrap_callback as a static method. Move type aliases out
of TYPE_CHECKING block.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… access

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adamtheturtle adamtheturtle merged commit 47dcb0e into main Feb 15, 2026
11 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/response-delay branch February 15, 2026 08:20
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.

1 participant