From: Cédric Ollivier Date: Sun, 14 May 2017 06:50:32 +0000 (+0200) Subject: Assign the wrapped function’s attributes X-Git-Tag: opnfv-5.0.RC1~413^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F47%2F34747%2F1;p=functest.git Assign the wrapped function’s attributes It mainly assigns to the wrapper push_results_to_db's __name__, __module__ and __doc__ and the documentation string. Change-Id: Idc882ac4e743699a4887e46c5066e0983c90afd9 Signed-off-by: Cédric Ollivier --- diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py index 46ffe35d1..bfbdf048d 100644 --- a/functest/utils/decorators.py +++ b/functest/utils/decorators.py @@ -3,6 +3,7 @@ # pylint: disable=missing-docstring import errno +import functools import os import urlparse @@ -41,6 +42,7 @@ def can_dump_request_to_file(method): else: return session.request(method=method, url=url, **kwargs) + @functools.wraps(method) def hook(*args, **kwargs): with mock.patch('requests.api.request', side_effect=patch_request): return method(*args, **kwargs)