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:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user