Skip to content

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

@Some7hing0riginal

Description

@Some7hing0riginal

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions