Closed jarhill0 closed 4 years ago
Pushed requested changes.
Rather than after_stop
, I've written the hook as before_stop
because I'd like the cassette to be available to the hook if the hook needs it, rather than just firing a hook with no parameters due to the cassette having already been ejected.
These are good suggestions, thanks. I'm going to switch the approach.
Pushed a change so that the hooks are stored on the Configuration
class. I didn't understand your comment about why we would change the signature of dispatch_hooks
, since the hooks in that file will always belong to the Configuration
class.
I did copy that function over from cassette.py
, but seeing as this will be only the second use of the function, I didn't think it was worth it to refactor the function out into another file.
Fixes #178.
This PR adds two new hooks:
cassette_load
andcassette_eject
. They are called when a cassette is first loaded or when it is ejected, respectively. Here's a demonstration of the hooks in use along with the corresponding output.I've also added a little section to the documentation about the new hooks in which I guess that these hooks will be first released with Betamax 0.9.0, which may or may not need to be corrected.