-
Notifications
You must be signed in to change notification settings - Fork 62
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
Why should we use this instead of VCR? #125
Comments
It's a bit different than that. This was specifically written for python-requests. Because of that, we avoid some of the sharper edge cases users tend to have with VCR.py. There's a pretty significant number of companies choosing betamax over VCR.py due to the stability and maintenance of it. Otherwise, it comes down to how you want to write your tests and what test framework integrations you want out of the box. |
Author of VCR.py here. I would say the main difference between the two libraries is how they hook into the HTTP request cycle. VCR.py mocks at the httplib layer, while betamax uses an API on requests. The method betamax uses is cleaner, but limits the support to only requests. VCR.py can work with different http libraries (requests, urllib, urllib2, aiohttp, tornado, etc). That said, I consider VCR to be well maintained and stable. I would love to hear about any "sharp edge cases users tend to have with VCR.py" so I can fix them! |
Just to be clear: I filed this bug because I wanted the documentation to clarify why Betamax exists. So far it sounds like it's a cleaner implementation (since it doesn't support other libraries), but as a user I don't much care about that, provided they work the same at the API level I use. Are there concrete things we could add to the Betamax documentation that would help people like me that are trying to decide which library to use? Right now I haven't heard much (aside from cleanliness). |
So when I wrote Betamax, VCR wasn't yet 1.0 and seemed quite dead. That's why Betamax exists today. I've no other reasoning beyond that anecdata about why people continue to pick Betamax over VCR.py
When I started Betamax I found a bunch. I found it easier to just write Betamax at the time since PRs were languishing and issues were staying open for quite a bit. Also, since I only cared about Requests, it was easier to do things in a Requests kind of way that completely avoids monkey-patching. At least one thing I remember running into was monkey-patches not being unset properly when a test errorred. Honestly, I don't really have any compelling reasons for anyone to use Betamax over VCR.py. They both do the same thing but in different ways. |
I have found both libs in the same time. I like the source code of betamax - it's clean and easy to maintain. VCS: @vcr_instance.use_cassette()
def test_my_endpoint_wich_uses_external_SDK(api_client):
response = api_client.post(url)
assert rv.status_code == 200 In tests with betamax you have to provide |
@guyzmo 👏 I, for one, wouldn't use an API client that didn't allow me to customize the underlying session anyway. There are times I know I'll need to configure Retries and I'll want to do those my way in Requests rather than rely on the library to do that for me. Then again I'm biased as a core developer of Requests =) |
I appreciate the discussion here. Should we just put a link to this issue in the readme for betamax? It seems like this is as good as any documentation we could write. Or we can just hope people find their way here and let lying dogs lay. |
Woops! I didn't mean to close this. I've been thinking that an FAQ would be good to add to Betamax's published documentation. I'd like this added there if anyone wants to tackle starting that document. |
I'm evaluating VCR and was ready to use it when I discovered this library. I read the readme, and some of the documentation, but I haven't found any explanation of why I would choose this over VCR.
The closest thing I've found is that this is VCR for python requests. But...VCR supports requests...so...where does that leave me?
Can this be clarified and added to the documentation?
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39549676-why-should-we-use-this-instead-of-vcr?utm_campaign=plugin&utm_content=tracker%2F198445&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F198445&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: