Anton Shestakov <av6@dwimlabs.net>, Sun, 19 Jun 2016 14:07:11 +0800
incoming: skip checking the whole line when it's linter output
When a line starts with a certain pattern, it's recognized as linter output,
but determining if it's an error or a warning was done looking at the whole
string again multiple times. Let's save on regexes and look only on the
important part.
tests/test_viewer.py
Permissions: -rw-r--r--
from tornado.testing import AsyncHTTPTestCase from candolint.models import database, Project, Change, Check from viewer import CandolintViewer database.init(':memory:') database.create_tables([Project, Change, Check], safe=True) database.connect = Mock() class ViewerTestCase(AsyncHTTPTestCase): response = self.fetch('/') assert response.code == 200 assert 'online linter' in response.body response = self.fetch('/nobodyhere') assert response.code == 404 assert 'online linter' in response.body