test_stream_timeout and test_urllib3_pool_connection_closed pass without asserting when no exception is raised
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Bắt đầu từ tests/test_requests.py, tại TestTimeout.test_stream_timeout và test_invalid_timeout ở gần đó, hàm này đã dùng pytest.raises. Chạy các test timeout với fixture httpbin để xác nhận chúng đang pass. Sau đó kiểm tra test_urllib3_pool_connection_closed, nơi assertion nằm trong khối except. Hoàn thành khi mỗi test đều fail nếu exception mong đợi không được raise. Test thứ hai có thể cần maintainer quyết định nên assert hành vi nào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Two tests in tests/test_requests.py put their only assertion inside an except block, so they pass without checking anything when the exception is not raised.
TestTimeout.test_stream_timeout: if the request to delay/10 completed without timing out, the test would pass. Switching it to pytest.raises (like test_invalid_timeout right below it) makes it fail in that case:
def test_stream_timeout(self, httpbin):
with pytest.raises(requests.exceptions.Timeout) as e:
requests.get(httpbin("delay/10"), timeout=2.0)
assert "Read timed out" in e.value.args[0].args[0]
I checked that this version passes as is and fails with DID NOT RAISE when pointed at delay/0. The change is in this commit on my fork, if it's useful: https://github.com/jeffev/requests/commit/b5058def5811
test_urllib3_pool_connection_closed: with the current urllib3, s.get() on an adapter mounted with pool_connections=0, pool_maxsize=0 succeeds (I get a 200), so the except ConnectionError branch never runs and the test checks nothing. I'm not sure what behavior it should pin down now, so I didn't touch it.
I'd have opened a PR, but pull requests seem limited to collaborators.
- Ngôn ngữ chính
- Python
- Star
- 54.6k
- Fork
- 12.1k
- Merge trung bình
- 18 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của psf/requests
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Docs: link security vulnerability reports from CONTRIBUTING.mdCó thể đã có người làm @young1lin đã nhận 5 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
TestTimeout abandons three delay/10 requests and later tests wait out the serverCó thể làm lại được @hananbahi527 đã nhận 18 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Issue tương tự
-
PluginProvider.storeInstance races and clobbers the dedup cache for concurrent loadsCó thể đã có người làm @Wilson0511 đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
community documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
kagent-dev/kagent#3462 ·
Maintainer thường phản hồi trong vòng 1 ngày