def authorization(self, func): """ Define a authorization process. """ if self.app is None: raise PluginException('The plugin must be installed to application.') self.authorize = muffin.to_coroutine(func) return func
def authorization(self, func): """ Define a authorization process. """ if self.app is None: raise PluginException( 'The plugin must be installed to application.') self.authorize = muffin.to_coroutine(func) return func
def pytest_pyfunc_call(pyfuncitem): """Support for async tests.""" if 'async' in pyfuncitem.keywords: loop_ = pyfuncitem.funcargs['loop'] funcargs = pyfuncitem.funcargs testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames} coro = muffin.to_coroutine(pyfuncitem.obj) loop_.run_until_complete(asyncio.async(coro(**testargs), loop=loop_))