1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Merge pull request #217 from bcen/fix-decoration-no-return

Fix use_cassette when used as decorator does not return the wrapped function's return value
This commit is contained in:
Ivan 'Goat' Malison
2015-10-02 00:11:20 -07:00
2 changed files with 12 additions and 1 deletions

View File

@@ -301,6 +301,17 @@ def test_additional_matchers():
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()):
def no_decoration(self):

View File

@@ -127,7 +127,7 @@ class CassetteContextDecorator(object):
def _handle_function(self, function, args, kwargs):
with self as cassette:
self.__handle_function(cassette, function, args, kwargs)
return self.__handle_function(cassette, function, args, kwargs)
@staticmethod
def get_function_name(function):