1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 09:35:34 +00:00

Add global toggle to use_cassette.

This commit is contained in:
Ivan Malison
2014-09-17 01:28:54 -07:00
parent 0cfe63ef6e
commit 366e2b75bb
3 changed files with 47 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
import logging
from .config import VCR
from . import cassette
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
@@ -9,6 +10,9 @@ except ImportError:
def emit(self, record):
pass
def global_toggle(enabled=True):
cassette.use_cassette._enabled = enabled
logging.getLogger(__name__).addHandler(NullHandler())