pytest-vcr
pytest-vcr copied to clipboard
Pytest-vcr seems not to work
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!
Are you sure you installed pytest-vcr
package ? (pip install pytest-vcr
)
Having same issue. Does this not work with requests package?
The thing you marked is not a test. You can only mark tests.