betamaxpy / betamax

A VCR imitation designed only for python-requests.
https://betamax.readthedocs.io/en/latest/
Other
567 stars 62 forks source link

decorator for @use_cassette #61

Closed yarikoptic closed 9 years ago

yarikoptic commented 9 years ago

I am yet to start using betamax (thanks to your talk at pycon 2015), but immediately caught a pattern I would have preferred to use -- by decorating test functions/methods instead of context manager. I guess if decorating test methods it could automagically (or optionally) establish a session for the class. FWIW vcr.py seems to provide similar functionality (@vcr.use_cassette)

sigmavirus24 commented 9 years ago

In otherwords, something like:

import betamax

@betamax.use_cassette('cassette_name')
def test_foo(session):
    session.get(...)
sigmavirus24 commented 9 years ago

Hey @yarikoptic, sorry for the delay. I started working on this on the feature/61 branch (c17d0cb).