responses icon indicating copy to clipboard operation
responses copied to clipboard

Using pytest fixture doesn't update calls with request/response on passthru

Open Some7hing0riginal opened this issue 10 months ago • 0 comments

Describe the bug

Calls not updated when using version 0.5.1 of pytest-responses.

Additional context

The workaround for this is to not use the pytest fixture. Works perfectly when using responses module directly using PassthroughResponse.

Version of responses

0.25.6

Steps to Reproduce

import requests
def test_toy_example(responses):
    responses.add_passthru(re.compile("https://api.weatherstack.com/\\w+"))
    response = requests.get("https://api.weatherstack.com/historical")
    assert response.status_code == 200 # assertion passes
    responses.calls[0].response()  # index out of bounds

Expected Result

Expect the calls to be populated and updated for passthrus.

Actual Result

responses.calls are not updated/captured for passthru

Some7hing0riginal avatar Feb 16 '25 17:02 Some7hing0riginal