How to use responses with cachecontrol?
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu bằng cách chạy bài kiểm thử được cung cấp với responses 0.25.8, CacheControl 0.14.2, requests 2.32.4 và Python 3.12.6, sau đó so sánh với responses 0.12.1. Theo dõi cách responses xử lý requests Session và các adapter của nó; hoàn thành khi một lỗi kết nối bị buộc xảy ra trả về response đã được lưu vào cache trước đó như trong bản tái hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hey folks,
We're trying to update some libs and hit an odd issue with updating responses. Consider this test:
import responses
import requests
from cachecontrol import CacheControl
def get_client():
return CacheControl(requests.Session())
@responses.activate
def test_with_cachecontrol():
client = get_client()
responses.add(responses.GET, "http://test-website.com", body="Hello, world!")
response = client.get("http://test-website.com")
assert response.text == "Hello, world!"
# force a connection error. Though since we're cached, it should return the cached response.
responses.add(responses.GET, "http://test-website.com", body=ConnectionError())
response = client.get("http://test-website.com")
assert response.text == "Hello, world!"
(This is a simplified version of the test in our code, but should suffice.)
The gist here is we use responses to force a valid response, then after we try to force it to instead raise a ConnectionError. Normally this would lead to the cached version of the data coming back. However once we go to reponses==0.25.8 from where we previously were in responses=0.12.1 this no longer works. We get the ConnectionError raised instead of getting the cached response.
I think responses isn't running the adapters that are otherwise on the session anymore. Is there a way to still run them for this type of testing?
If it helps, heres some more info about dependencies:
CacheControl=0.14.2
requests=2.32.4
python 3.12.6 on Mac
- Ngôn ngữ chính
- Python
- Star
- 4.3k
- Fork
- 389
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 getsentry/responses
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Có thể đã có người làm @mayureshsonawane17 đã nhận 28 ngày trước. Đang mởWaiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement Waiting for: Product Owner
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
getsentry/responses#783 · 1 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Bad Network SimulationĐang mởenhancement question
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
getsentry/responses#765 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của getsentry/responses
Issue tương tự
-
area:scripts area:tests bug priority:later
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Ikalus1988/MisakaNet#4358 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Discovered ports from service discovery are never propagated to modules in Module.load()Có thể đã có người làm @vishalmore90 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OWASP/Nettacker#1828 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aws-samples/sample-per-model-bedrock#708 ·
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
-
[Performance] Bound resolve_api_hashes raw fallback reads to the 1 MiB region actually scannedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sjkim1127/Reversecore_MCP#365 ·
Maintainer thường phản hồi trong vòng 1 ngày