Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest-vcr seems not to work #44

Open
gustavonmartins opened this issue Mar 4, 2021 · 3 comments
Open

Pytest-vcr seems not to work #44

gustavonmartins opened this issue Mar 4, 2021 · 3 comments

Comments

@gustavonmartins
Copy link

I was using python-vcr before, which was working as expected, but I need it to be active only for testing purposes. On production I need contact to the real API.

Hi, I used pytest-vcr, version 1.0.1 and 1.0.2 and it didnt generate any cassete file.

My code is as follows:

@pytest.mark.vcr()
def _get_json_from_api(
    prog: str, iref: str, cpno: str, ipai: int
):
    import requests

    ADDRESS= config("ADDRESS", cast=str)

    payload = {
        "prog": prog,
        "iref": iref,
        "ipai": str(ipai),
        "cpno": cpno,
    }
    request = requests.get(
        ADDRESS,
        params=payload,
        verify=False,
    )
    return request.json()

I didnt see any cassete being generated, and no warning whatsoever came. Im quite lost.

Can you give me a hint on how to solve this?

Thank you so much!

@brunetton
Copy link

Are you sure you installed pytest-vcr package ? (pip install pytest-vcr)

@quidproquo
Copy link

Having same issue. Does this not work with requests package?

@prescod
Copy link

prescod commented Aug 1, 2021

The thing you marked is not a test. You can only mark tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants