def client(): loop = asyncio.get_event_loop() app = build_app(loop) client = webtest_aiohttp.TestApp(app) client.expect_errors = False aiohttp.parsers.StreamWriter.set_tcp_cork = lambda s, v: True aiohttp.parsers.StreamWriter.set_tcp_nodelay = lambda s, v: True return client
def client(tmpdir): with tmpdir.as_cwd(): tmpdir.ensure('genconf', dir=True) make_default_config_if_needed('genconf/config.yaml') # TODO(cmaloney): the app building should probably be per-test-session # fixture. loop = asyncio.get_event_loop() app = build_app(loop) client = webtest_aiohttp.TestApp(app) client.expect_errors = False aiohttp.parsers.StreamWriter.set_tcp_cork = lambda s, v: True aiohttp.parsers.StreamWriter.set_tcp_nodelay = lambda s, v: True # Yield so that the tmpdir we enter applies to tests this hits. # TODO(cmaloney): changing to a tmpdir in the fixutre is weird / probably # not the best way to do this, but works for now. yield client
def create_testapp(self, app): return webtest_aiohttp.TestApp(app)
def create_testapp(self, app): loop = asyncio.get_event_loop() self.loop = loop return webtest_aiohttp.TestApp(app, loop=loop)
def testapp(app, loop): return webtest_aiohttp.TestApp(app, loop=loop)
def testapp(app): return webtest_aiohttp.TestApp(app)