From d59a6910f729a5584e9e5a87ad39f8499f634e01 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Mon, 12 Sep 2016 09:07:26 +0100 Subject: [PATCH] Return the value of a decorated function --- bugsnag/client.py | 2 +- tests/test_client.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bugsnag/client.py b/bugsnag/client.py index dedf7b5f..f2a453de 100644 --- a/bugsnag/client.py +++ b/bugsnag/client.py @@ -117,7 +117,7 @@ def __call__(self, function): @wraps(function) def decorate(*args, **kwargs): with self: - function(*args, **kwargs) + return function(*args, **kwargs) return decorate diff --git a/tests/test_client.py b/tests/test_client.py index bf7977da..22e2440e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -115,6 +115,14 @@ def foo(): self.assertSentReportCount(1) + def test_capture_decorator_returns_value(self): + + @self.client.capture + def foo(): + return "300" + + self.assertEqual(foo(), "300") + def test_capture_decorator_raises(self): @self.client.capture