Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

TestTimeout abandons three delay/10 requests and later tests wait out the server

Open Beginner friendly
#7,631 6 comments 0 reactions 0 assignees View on GitHub

@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.0
  • tests/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/10 to delay/3 (client timeout 2.0)
  • line 2573, delay/10 to delay/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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from psf/requests

All issues in psf/requests

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.