MCPcopy
hub / github.com/aio-libs/aiohttp / create_server

Method create_server

tests/test_web_functional.py:44–60  ·  view source on GitHub ↗
(self, method, path, handler=None, ssl_ctx=None,
                      logger=log.server_logger)

Source from the content-addressed store, hash-verified

42
43 @asyncio.coroutine
44 def create_server(self, method, path, handler=None, ssl_ctx=None,
45 logger=log.server_logger):
46 app = web.Application(loop=self.loop)
47 if handler:
48 app.router.add_route(method, path, handler)
49
50 port = self.find_unused_port()
51 self.handler = app.make_handler(
52 keep_alive_on=False,
53 access_log=log.access_logger,
54 logger=logger)
55 srv = yield from self.loop.create_server(
56 self.handler, '127.0.0.1', port, ssl=ssl_ctx)
57 protocol = "https" if ssl_ctx else "http"
58 url = "{}://127.0.0.1:{}".format(protocol, port) + path
59 self.addCleanup(srv.close)
60 return app, srv, url
61
62
63class TestWebFunctional(WebFunctionalSetupMixin, unittest.TestCase):

Callers

nothing calls this directly

Calls 4

find_unused_portMethod · 0.95
make_handlerMethod · 0.95
add_routeMethod · 0.45
create_serverMethod · 0.45

Tested by

no test coverage detected