tornado: Extract AsyncDjangoHandlerBase and mark as nocoverage.

We're never going to add tests for this block, which is fundamentally
well-tested code from Django with a since line changed which is hard
to screw up (long-polling will not work at all without it).  The hope
is to remove it entirely and replace it with a cleaner monkey-patch,
but until then, unit tests for it would be redundant.
This commit is contained in:
Tim Abbott
2018-05-15 18:39:52 -07:00
parent 00861b910d
commit 276b78e952

View File

@@ -74,7 +74,8 @@ def finish_handler(handler_id: int, event_queue_id: str,
# Modified version of the base Tornado handler for Django
class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
# We mark this for nocoverage, since we only change 1 line of actual code.
class AsyncDjangoHandlerBase(tornado.web.RequestHandler, base.BaseHandler): # nocoverage
initLock = Lock()
def __init__(self, *args: Any, **kwargs: Any) -> None:
@@ -323,6 +324,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
return response
class AsyncDjangoHandler(AsyncDjangoHandlerBase):
def zulip_finish(self, response: Dict[str, Any], request: HttpRequest,
apply_markdown: bool) -> None:
# Make sure that Markdown rendering really happened, if requested.