1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Refactor build_patchers into class. Fix issue with patching non existent attribute with hasattr.

This commit is contained in:
Ivan Malison
2014-09-18 09:24:28 -07:00
parent e1e08c7a2c
commit 4868a63876
2 changed files with 91 additions and 79 deletions

View File

@@ -7,7 +7,7 @@ except ImportError:
from .compat.counter import Counter
# Internal imports
from .patch import build_patchers
from .patch import PatcherBuilder
from .persist import load_cassette, save_cassette
from .filters import filter_request
from .serializers import yamlserializer
@@ -36,7 +36,7 @@ class CassetteContextDecorator(object):
def _patch_generator(self, cassette):
with contextlib2.ExitStack() as exit_stack:
for patcher in build_patchers(cassette):
for patcher in PatcherBuilder(cassette).build_patchers():
exit_stack.enter_context(patcher)
yield cassette
# TODO(@IvanMalison): Hmmm. it kind of feels like this should be somewhere else.