Drop decorator for async test

This commit is contained in:
Julien Duponchelle
2015-01-20 18:55:17 +01:00
parent db31afeb63
commit 54eb8d9e81
6 changed files with 30 additions and 36 deletions

View File

@ -24,7 +24,7 @@ class _asyncio_patch:
"""
A wrapper around python patch supporting asyncio.
Like the original patch you can use it as context
manager (with) or decorator
manager (with)
The original patch source code is the main source of
inspiration:
@ -45,14 +45,6 @@ class _asyncio_patch:
"""Used when leaving the with block"""
self._patcher.stop()
def __call__(self, func, *args, **kwargs):
"""Call is used when asyncio_patch is used as decorator"""
@patch(self.function, return_value=self._fake_anwser())
@asyncio.coroutine
def inner(*a, **kw):
return func(*a, **kw)
return inner
def _fake_anwser(self):
future = asyncio.Future()
future.set_result(self.kwargs["return_value"])