TestTimeout abandons three delay/10 requests and later tests wait out the server
@hananbahi527 is already working on this.
Since Oct 14, 2026.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 90/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- testing-qa
Research direction
Start at tests/test_requests.py:2539 and :2573 in TestTimeout, where the delay/10 endpoints are used. Change the delays to delay/3 and delay/1 while preserving the client timeouts and assertions. Run the two timeout tests with TestTimeout::test_encoded_methods and confirm the suite avoids the unnecessary server waits with the same results.
Written by the indexing model from the issue text.
Description
TestTimeout makes three requests to httpbin("delay/10") and abandons all of them:
tests/test_requests.py:2539,test_stream_timeout,timeout=2.0tests/test_requests.py:2573,test_read_timeout, parametrized,timeout=0.1(two params)
The client raises at 2.0s and 0.1s, but the pytest-httpbin server keeps sleeping the full 10 seconds and serves requests serially. The next test that needs the server blocks until those sleeps finish.
$ pytest "tests/test_requests.py::TestTimeout::test_encoded_methods" -p no:randomly
1 passed in 0.56s
$ pytest "tests/test_requests.py::TestTimeout::test_read_timeout" \
"tests/test_requests.py::TestTimeout::test_encoded_methods" \
-p no:randomly --durations=5
19.79s call tests/test_requests.py::TestTimeout::test_encoded_methods
0.11s call tests/test_requests.py::TestTimeout::test_read_timeout[timeout1]
0.10s call tests/test_requests.py::TestTimeout::test_read_timeout[timeout0]
3 passed in 20.55s
test_encoded_methods is one line (requests.request(b"GET", httpbin("get"))). The 19.79s is 2 x 10s of server sleep minus the 0.2s the two clients used. In a full run the cost lands on whichever tests happen to follow:
19.35s call TestTimeout::test_encoded_methods
8.00s call TestTimeout::test_none_timeout[None]
Both call sites need the server to outlast the client timeout, not to sleep for 10 seconds. Lowering the delays leaves the assertions unchanged:
- line 2539,
delay/10todelay/3(client timeout 2.0) - line 2573,
delay/10todelay/1(client timeout 0.1)
With that change, TestTimeout goes from 30.56s to 5.70s and the full suite from 167.44s to 142.04s, with the same results either way: 630 passed, 3 skipped, 1 xpassed. The single failure in both runs is TestPreparingURLs::test_different_connection_pool_for_tls_settings_verify_bundle_unexpired_cert, which is unrelated and fails before the change as well.
Measured at 611c616 on Windows 11, Python 3.14.2, pytest 9.1.1.
- Dominant language
- Python
- Stars
- 54.5k
- Forks
- 12.9k
- Avg merge
- 3h 26m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from psf/requests
-
Non-string form field names raise AttributeError when files are attachedPossibly taken @nightcityblade claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Incorrect type annotation for iter_linesMay be free again @nightcityblade claimed this 23 days ago, and no pull request is open. Open
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
proxy_bypass_registry uses unanchored re.match (Windows proxy bypass)May be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Docstring examples in `from_key_val_list` show the pre-3.12 OrderedDict reprMay be free again @Abirami-26 claimed this 23 days ago, and no pull request is open. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
collective/icalendar#1968 · 1 comment ·
Maintainers usually reply within 1 day
-
Deferred from #1869: Complete the companion pytest guardrail update noted in the PR description...Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#140958 ·
Maintainers usually reply within 1 day
-
Bug triage/confirmed
Difficulty 2/5 Half a day Newbie friendliness 85/100
agentscope-ai/agentscope#3355 ·
Maintainers usually reply within 2 days