Open finswimmer opened 9 months ago
I had a very similar issue attempting to use VCR to record the https requests from the OpenAI API client in an async function. The same fix worked for me - downgraded to 5.1.0
, recorded the https calls, and then bumped back to 6.0.1
. Let me know if there specific information I can provide here.
So I think I've figured out what exactly is going on.
If you use the httpx AsyncClient from an async method where the client is created in the call chain (arbitrarily deep) then it works just fine.
If you use the non-async httpx client from a sync method call chain it works fine.
If you use the sync httpx client from an async method, it fails.
This all makes sense and likely the code just needs to check if it is currently running in an event loop and do the right thing accordingly.
Hey,
just a gently reminder about this issue :smiley:
fin swimmer
Hello,
this one took me a while to find out what's going on and how to reproduce.
To reproduce this I'm using:
The following test works if
vcrpy
in version5.1.0
is installed as a dependency forpytest-recording
:But it will fail if version
6.0.1
ofvcrpy
is used instead.The error only occurs if there is no record already. Once there is one (e.g. created by an older version) the replay works without issues.