If you are already using pytest to write your tests and are also using vcr to record and replay http responses, you already know that any http request is being recorded, so the next time the same request is made, the test won’t hit the real endpoint but it will use the recorded response.
Sometimes you need to exclude localhost
(or other hosts) from being recorded and you can do thanks to this vcr parameter:
|
|
This works, but what if you have many tests and you want to ignore localhost
globally?
You can do it by adding this to your main conftest.py
and all your vcr tests will ignore it by default:
|
|
That’s it! I hope you find this suggestion useful.