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

Make cassettes thread-safe #52

Open
sigmavirus24 opened this issue Mar 6, 2015 · 1 comment
Open

Make cassettes thread-safe #52

sigmavirus24 opened this issue Mar 6, 2015 · 1 comment
Milestone

Comments

@sigmavirus24
Copy link
Collaborator

sigmavirus24 commented Mar 6, 2015

I'm wondering if there's a need to test items using requests in thread-safe manner and how that would work with betamax. Currently the access to cassette files is not threadsafe and I'm wondering what would be necessary to ensure thread-safety.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9271963-make-cassettes-thread-safe?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).
@sigmavirus24
Copy link
Collaborator Author

So, we'd probably have to use pylockfile to ensure we don't update the same cassette twice. That would probably give us 90% of what we need. Namely, this would be great for the case where we are testing an application that's sharing a session between threads. Even though this isn't a recommendation requests makes, Betamax should still attempt to support it.

Further, I think the dependency on pylockfile should be optional that could be installed from an extra for betamax, e.g., pip install betamax[threadsafe].

The code to integrate this with the current Cassette class should be minimal.

@sigmavirus24 sigmavirus24 modified the milestone: 1.0.0 Jul 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant