mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
fix decoration when in _handle_function does not return the wrapped function return value
This commit is contained in:
@@ -301,6 +301,17 @@ def test_additional_matchers():
|
|||||||
function_additional()
|
function_additional()
|
||||||
|
|
||||||
|
|
||||||
|
def test_decoration_should_respect_function_return_value():
|
||||||
|
vcr = VCR()
|
||||||
|
ret = 'a-return-value'
|
||||||
|
|
||||||
|
@vcr.use_cassette
|
||||||
|
def function_with_return():
|
||||||
|
return ret
|
||||||
|
|
||||||
|
assert ret == function_with_return()
|
||||||
|
|
||||||
|
|
||||||
class TestVCRClass(VCR().test_case()):
|
class TestVCRClass(VCR().test_case()):
|
||||||
|
|
||||||
def no_decoration(self):
|
def no_decoration(self):
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class CassetteContextDecorator(object):
|
|||||||
|
|
||||||
def _handle_function(self, function, args, kwargs):
|
def _handle_function(self, function, args, kwargs):
|
||||||
with self as cassette:
|
with self as cassette:
|
||||||
self.__handle_function(cassette, function, args, kwargs)
|
return self.__handle_function(cassette, function, args, kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_function_name(function):
|
def get_function_name(function):
|
||||||
|
|||||||
Reference in New Issue
Block a user